From 111e339d06049cc713455749d2978ffd6b9ab819 Mon Sep 17 00:00:00 2001 From: Christian Hesse Date: Tue, 24 Mar 2020 12:12:00 +0100 Subject: netwatch-notify: report the number of checks a host was down --- netwatch-notify | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/netwatch-notify b/netwatch-notify index d2d256b..85a1ee5 100644 --- a/netwatch-notify +++ b/netwatch-notify @@ -25,10 +25,12 @@ :if ($HostVal->"status" = "up") do={ $LogPrintExit debug ("Host " . $HostName . " (" . $HostVal->"host" . ") is up.") false; + :local Count ($Metric->"count"); :set ($Metric->"count") 0; :if ($Metric->"notified" = true) do={ $SendNotification ("Netwatch Notify: " . $HostName . " up") \ - ("Host " . $HostName . " (" . $HostVal->"host" . ") is up since " . $HostVal->"since" . "."); + ("Host " . $HostName . " (" . $HostVal->"host" . ") is up since " . $HostVal->"since" . ".\n" . \ + "It was down for " . $Count . " checks."); } :set ($Metric->"notified") false; } else={ -- cgit v1.2.3-70-g09d2