aboutsummaryrefslogtreecommitdiffstats
path: root/netwatch-notify
diff options
context:
space:
mode:
authorGravatar Christian Hesse <mail@eworm.de>2020-03-24 12:12:00 +0100
committerGravatar Christian Hesse <mail@eworm.de>2020-03-24 12:12:00 +0100
commit111e339d06049cc713455749d2978ffd6b9ab819 (patch)
tree3c18e9f1658765dafcd4b4ff0f38e0f2a3254a2c /netwatch-notify
parent5f46ef7635f27f6180898815cebd954617790b37 (diff)
netwatch-notify: report the number of checks a host was down
Diffstat (limited to 'netwatch-notify')
-rw-r--r--netwatch-notify4
1 files changed, 3 insertions, 1 deletions
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={