@@ -69,7 +69,7 @@ $ScriptLock $0;
6969 :if ($HostInfo->"notify" = true && $HostInfo->"disabled" != true) do={
7070 :local Name [ $EitherOr ($HostInfo->"name") ($HostVal->"name") ];
7171
72- :local Metric { "count-down"=0; "notified"=false };
72+ :local Metric { "count-down"=0; "count-up"=0; " notified"=false };
7373 :if ([ :typeof ($NetwatchNotify->$Name) ] = "array") do={
7474 :set $Metric ($NetwatchNotify->$Name);
7575 }
@@ -104,6 +104,7 @@ $ScriptLock $0;
104104 ("The " . $Type . " '" . $Name . "' (" . $HostDetails . ") is up.") false;
105105 :set ($Metric->"count-down") 0;
106106 }
107+ :set ($Metric->"count-up") ($Metric->"count-up" + 1);
107108 :if ($Metric->"notified" = true) do={
108109 :local Message ("The " . $Type . " '" . $Name . "' (" . $HostDetails . \
109110 ") is up since " . $HostVal->"since" . ".\n" . \
@@ -122,6 +123,7 @@ $ScriptLock $0;
122123 :set ($Metric->"since");
123124 } else={
124125 :set ($Metric->"count-down") ($Metric->"count-down" + 1);
126+ :set ($Metric->"count-up") 0;
125127 :set ($Metric->"parent") ($HostInfo->"parent");
126128 :set ($Metric->"since") ($HostVal->"since");
127129 :local CountDown [ $IfThenElse ([ :tonum ($HostInfo->"count-down") ] > 0) ($HostInfo->"count-down") 5 ];
@@ -167,6 +169,7 @@ $ScriptLock $0;
167169 }
168170 :set ($NetwatchNotify->$Name) {
169171 "count-down"=($Metric->"count-down");
172+ "count-up"=($Metric->"count-up");
170173 "notified"=($Metric->"notified");
171174 "parent"=($Metric->"parent");
172175 "resolve-failed"=($Metric->"resolve-failed");
0 commit comments