diff options
-rw-r--r-- | netwatch-notify | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/netwatch-notify b/netwatch-notify index dbf6e10..1d285de 100644 --- a/netwatch-notify +++ b/netwatch-notify @@ -128,6 +128,7 @@ $ScriptLock $0; :set ($Metric->"since") ($HostVal->"since"); :local CountDown [ $IfThenElse ([ :tonum ($HostInfo->"count-down") ] > 0) ($HostInfo->"count-down") 5 ]; :local Parent ($HostInfo->"parent"); + :local ParentUp false; :while ([ :len $Parent ] > 0) do={ :set CountDown ($CountDown + 1); :set Parent ($NetwatchNotify->$Parent->"parent"); @@ -137,6 +138,7 @@ $ScriptLock $0; :while ($ParentNotified = false && [ :len $Parent ] > 0) do={ :set ParentNotified [ $IfThenElse (($NetwatchNotify->$Parent->"notified") = true) \ true false ]; + :set ParentUp ($NetwatchNotify->$Parent->"count-up"); :if ($ParentNotified = false) do={ :set Parent ($NetwatchNotify->$Parent->"parent"); } @@ -151,7 +153,7 @@ $ScriptLock $0; $NetwatchNotifyHook $Name $Type "pre-down" ($HostInfo->"pre-down-hook"); } :if ($ParentNotified = false && $Metric->"count-down" >= $CountDown && \ - $Metric->"notified" != true) do={ + ($ParentUp = false || $ParentUp > 2) && $Metric->"notified" != true) do={ :local Message ("The " . $Type . " '" . $Name . "' (" . $HostDetails . \ ") is down since " . $HostVal->"since" . "."); :if ([ :typeof ($HostInfo->"down-hook") ] = "str") do={ |