netwatch-notify: report the number of checks a host was down

This commit is contained in:
Christian Hesse 2020-03-24 12:12:00 +01:00
parent 5f46ef7635
commit 111e339d06

View file

@ -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={