From bccb7c3452466aea0f8c1790643b3aeb21e9b1af Mon Sep 17 00:00:00 2001 From: Christian Hesse Date: Fri, 9 Jul 2021 11:27:26 +0200 Subject: netwatch-notify: implement pre-down hook --- netwatch-notify | 3 +++ 1 file changed, 3 insertions(+) (limited to 'netwatch-notify') diff --git a/netwatch-notify b/netwatch-notify index eecfa9f..966d415 100644 --- a/netwatch-notify +++ b/netwatch-notify @@ -117,6 +117,9 @@ $Metric->"count" . " checks, " . [ $IfThenElse ($ParentNotified = false) [ $IfThenElse \ ($Metric->"notified" = true) ("already notified.") ($Count - $Metric->"count" . " to go.") ] \ ("parent host " . $Parent . " is down.") ]) false; + :if ((($Count * 2) - ($Metric->"count" * 3)) / 2 = 0 && [ :typeof ($HostInfo->"pre-down-hook") ] = "str") do={ + $NetwatchNotifyHook $HostName "pre-down" ($HostInfo->"pre-down-hook"); + } :if ($ParentNotified = false && $Metric->"count" >= $Count && $Metric->"notified" != true) do={ :local Message ("Host " . $HostName . " (" . $HostVal->"host" . ") is down since " . $HostVal->"since" . "."); :if ([ :typeof ($HostInfo->"down-hook") ] = "str") do={ -- cgit v1.2.3-54-g00ecf