diff options
author | Christian Hesse <mail@eworm.de> | 2020-11-17 15:14:27 +0100 |
---|---|---|
committer | Christian Hesse <mail@eworm.de> | 2020-11-17 22:28:05 +0100 |
commit | d5125b816aeef0f86e48bdf5dbd1dccfe0164c9f (patch) | |
tree | 16ddf3eb59deacc5c32eeb6d2fd8d16456c631a0 /netwatch-notify | |
parent | 6c14412aa936d24a7a6c124b390bbd95fdc66cd7 (diff) |
netwatch-notify: be more verbose in logs
Diffstat (limited to 'netwatch-notify')
-rw-r--r-- | netwatch-notify | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/netwatch-notify b/netwatch-notify index 2462e9b..4c3586c 100644 --- a/netwatch-notify +++ b/netwatch-notify @@ -46,13 +46,15 @@ } else={ :set ($Metric->"count") ($Metric->"count" + 1); :set ($Metric->"since") ($HostVal->"since"); - $LogPrintExit info ("Host " . $HostName . " (" . $HostVal->"host" . ") is down for " . \ - $Metric->"count" . " checks.") false; :local Count [ $IfThenElse ([ :tonum ($HostInfo->"count") ] > 0) ($HostInfo->"count") 5 ]; :local ParentNotified [ $IfThenElse (($NetwatchNotify->($HostInfo->"parent")->"notified") = true) true false ]; :if ([ :len ($HostInfo->"parent") ] > 0) do={ :set Count ($Count + 1); } + $LogPrintExit info ("Host " . $HostName . " (" . $HostVal->"host" . ") is down for " . \ + $Metric->"count" . " checks, " . [ $IfThenElse ($ParentNotified = false) [ $IfThenElse \ + ($Metric->"notified" = true) ("already notified.") ($Count - $Metric->"count" . " to go.") ] \ + ("parent host " . $HostInfo->"parent" . " is down.") ]) false; :if ($ParentNotified = false && $Metric->"count" >= $Count && $Metric->"notified" != true) do={ $SendNotification ([ $SymbolForNotification "cross-mark" ] . "Netwatch Notify: " . $HostName . " down") \ ("Host " . $HostName . " (" . $HostVal->"host" . ") is down since " . $HostVal->"since" . "."); |