aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Christian Hesse <mail@eworm.de>2020-03-05 12:47:42 +0100
committerGravatar Christian Hesse <mail@eworm.de>2020-03-05 12:47:42 +0100
commitf3e2fb654b171446ce17e7ab01c7929d85f13839 (patch)
tree44708355b37729d74cae067a6c9f8f5daea99710
parent9aed03693c918aaff5462e9ed2300c05a787d2c4 (diff)
netwatch-notify: add logging
-rw-r--r--netwatch-notify4
1 files changed, 4 insertions, 0 deletions
diff --git a/netwatch-notify b/netwatch-notify
index dfa62e8..d2d256b 100644
--- a/netwatch-notify
+++ b/netwatch-notify
@@ -7,6 +7,7 @@
:global NetwatchNotify;
:global ParseKeyValueStore;
+:global LogPrintExit;
:global SendNotification;
:if ([ :typeof $NetwatchNotify ] = "nothing") do={
@@ -23,6 +24,7 @@
}
:if ($HostVal->"status" = "up") do={
+ $LogPrintExit debug ("Host " . $HostName . " (" . $HostVal->"host" . ") is up.") false;
:set ($Metric->"count") 0;
:if ($Metric->"notified" = true) do={
$SendNotification ("Netwatch Notify: " . $HostName . " up") \
@@ -31,6 +33,8 @@
:set ($Metric->"notified") false;
} else={
:set ($Metric->"count") ($Metric->"count" + 1);
+ $LogPrintExit info ("Host " . $HostName . " (" . $HostVal->"host" . ") is down for " . \
+ $Metric->"count" . " checks.") false;
:if ($Metric->"count" >= 5 && $Metric->"notified" != true) do={
$SendNotification ("Netwatch Notify: " . $HostName . " down") \
("Host " . $HostName . " (" . $HostVal->"host" . ") is down since " . $HostVal->"since" . ".");