aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--netwatch-notify20
1 files changed, 10 insertions, 10 deletions
diff --git a/netwatch-notify b/netwatch-notify
index 994a8d1..0451823 100644
--- a/netwatch-notify
+++ b/netwatch-notify
@@ -69,7 +69,7 @@ $ScriptLock $0;
:if ($HostInfo->"notify" = true && $HostInfo->"disabled" != true) do={
:local Name [ $EitherOr ($HostInfo->"name") ($HostVal->"name") ];
- :local Metric { "count"=0; "notified"=false };
+ :local Metric { "count-down"=0; "notified"=false };
:if ([ :typeof ($NetwatchNotify->$Name) ] = "array") do={
:set $Metric ($NetwatchNotify->$Name);
}
@@ -98,11 +98,11 @@ $ScriptLock $0;
}
:if ($HostVal->"status" = "up") do={
- :local CountDown ($Metric->"count");
+ :local CountDown ($Metric->"count-down");
:if ($CountDown > 0) do={
$LogPrintExit2 info $0 \
("The " . $Type . " '" . $Name . "' (" . $HostDetails . ") is up.") false;
- :set ($Metric->"count") 0;
+ :set ($Metric->"count-down") 0;
}
:if ($Metric->"notified" = true) do={
:local Message ("The " . $Type . " '" . $Name . "' (" . $HostDetails . \
@@ -121,10 +121,10 @@ $ScriptLock $0;
:set ($Metric->"parent") ($HostInfo->"parent");
:set ($Metric->"since");
} else={
- :set ($Metric->"count") ($Metric->"count" + 1);
+ :set ($Metric->"count-down") ($Metric->"count-down" + 1);
:set ($Metric->"parent") ($HostInfo->"parent");
:set ($Metric->"since") ($HostVal->"since");
- :local CountDown [ $IfThenElse ([ :tonum ($HostInfo->"count") ] > 0) ($HostInfo->"count") 5 ];
+ :local CountDown [ $IfThenElse ([ :tonum ($HostInfo->"count-down") ] > 0) ($HostInfo->"count-down") 5 ];
:local Parent ($HostInfo->"parent");
:while ([ :len $Parent ] > 0) do={
:set CountDown ($CountDown + 1);
@@ -141,14 +141,14 @@ $ScriptLock $0;
}
$LogPrintExit2 [ $IfThenElse ($HostInfo->"no-down-notification" != true) info debug ] $0 \
("The " . $Type . " '" . $Name . "' (" . $HostDetails . ") is down for " . \
- $Metric->"count" . " checks, " . [ $IfThenElse ($ParentNotified = false) [ $IfThenElse \
- ($Metric->"notified" = true) ("already notified.") ($CountDown - $Metric->"count" . \
+ $Metric->"count-down" . " checks, " . [ $IfThenElse ($ParentNotified = false) [ $IfThenElse \
+ ($Metric->"notified" = true) ("already notified.") ($CountDown - $Metric->"count-down" . \
" to go.") ] ("parent " . $Type . " " . $Parent . " is down.") ]) false;
- :if ((($CountDown * 2) - ($Metric->"count" * 3)) / 2 = 0 && \
+ :if ((($CountDown * 2) - ($Metric->"count-down" * 3)) / 2 = 0 && \
[ :typeof ($HostInfo->"pre-down-hook") ] = "str") do={
$NetwatchNotifyHook $Name $Type "pre-down" ($HostInfo->"pre-down-hook");
}
- :if ($ParentNotified = false && $Metric->"count" >= $CountDown && \
+ :if ($ParentNotified = false && $Metric->"count-down" >= $CountDown && \
$Metric->"notified" != true) do={
:local Message ("The " . $Type . " '" . $Name . "' (" . $HostDetails . \
") is down since " . $HostVal->"since" . ".");
@@ -166,7 +166,7 @@ $ScriptLock $0;
}
}
:set ($NetwatchNotify->$Name) {
- "count"=($Metric->"count");
+ "count-down"=($Metric->"count-down");
"notified"=($Metric->"notified");
"parent"=($Metric->"parent");
"resolve-failed"=($Metric->"resolve-failed");