aboutsummaryrefslogtreecommitdiffstats
path: root/netwatch-notify
diff options
context:
space:
mode:
authorGravatar Christian Hesse <mail@eworm.de>2020-08-24 14:02:40 +0200
committerGravatar Christian Hesse <mail@eworm.de>2020-08-24 14:26:55 +0200
commite58d8e43739744d88f04918ff0e74fabf0bcc37c (patch)
tree313bbfa8762ccbd1abb0c8b87ca11de0512e73a2 /netwatch-notify
parentd65874e142b5815a2fa32518bc710d2f4c78b5d8 (diff)
netwatch-notify: make check count threshold configurable
Signed-off-by: Christian Hesse <mail@eworm.de>
Diffstat (limited to 'netwatch-notify')
-rw-r--r--netwatch-notify6
1 files changed, 4 insertions, 2 deletions
diff --git a/netwatch-notify b/netwatch-notify
index 898ca99..b52c4d1 100644
--- a/netwatch-notify
+++ b/netwatch-notify
@@ -8,8 +8,9 @@
:global NetwatchNotify;
-:global ParseKeyValueStore;
+:global IfThenElse;
:global LogPrintExit;
+:global ParseKeyValueStore;
:global SendNotification;
:global SymbolForNotification;
@@ -45,7 +46,8 @@
: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={
+ :if ($Metric->"count" >= [ $IfThenElse ([ :typeof ($HostVal->"count") ] != "nothing") ($HostVal->"count") 5 ] && \
+ $Metric->"notified" != true) do={
$SendNotification ([ $SymbolForNotification "cross-mark" ] . "Netwatch Notify: " . $HostName . " down") \
("Host " . $HostName . " (" . $HostVal->"host" . ") is down since " . $HostVal->"since" . ".");
:set ($Metric->"notified") true;