mirror of
https://git.eworm.de/cgit/routeros-scripts
synced 2025-07-05 15:44:29 +02:00
netwatch-notify: add new array element to count up-checks
This commit is contained in:
parent
6f772e92a6
commit
a6645b3e75
1 changed files with 4 additions and 1 deletions
|
@ -69,7 +69,7 @@ $ScriptLock $0;
|
||||||
:if ($HostInfo->"notify" = true && $HostInfo->"disabled" != true) do={
|
:if ($HostInfo->"notify" = true && $HostInfo->"disabled" != true) do={
|
||||||
:local Name [ $EitherOr ($HostInfo->"name") ($HostVal->"name") ];
|
:local Name [ $EitherOr ($HostInfo->"name") ($HostVal->"name") ];
|
||||||
|
|
||||||
:local Metric { "count-down"=0; "notified"=false };
|
:local Metric { "count-down"=0; "count-up"=0; "notified"=false };
|
||||||
:if ([ :typeof ($NetwatchNotify->$Name) ] = "array") do={
|
:if ([ :typeof ($NetwatchNotify->$Name) ] = "array") do={
|
||||||
:set $Metric ($NetwatchNotify->$Name);
|
:set $Metric ($NetwatchNotify->$Name);
|
||||||
}
|
}
|
||||||
|
@ -104,6 +104,7 @@ $ScriptLock $0;
|
||||||
("The " . $Type . " '" . $Name . "' (" . $HostDetails . ") is up.") false;
|
("The " . $Type . " '" . $Name . "' (" . $HostDetails . ") is up.") false;
|
||||||
:set ($Metric->"count-down") 0;
|
:set ($Metric->"count-down") 0;
|
||||||
}
|
}
|
||||||
|
:set ($Metric->"count-up") ($Metric->"count-up" + 1);
|
||||||
:if ($Metric->"notified" = true) do={
|
:if ($Metric->"notified" = true) do={
|
||||||
:local Message ("The " . $Type . " '" . $Name . "' (" . $HostDetails . \
|
:local Message ("The " . $Type . " '" . $Name . "' (" . $HostDetails . \
|
||||||
") is up since " . $HostVal->"since" . ".\n" . \
|
") is up since " . $HostVal->"since" . ".\n" . \
|
||||||
|
@ -122,6 +123,7 @@ $ScriptLock $0;
|
||||||
:set ($Metric->"since");
|
:set ($Metric->"since");
|
||||||
} else={
|
} else={
|
||||||
:set ($Metric->"count-down") ($Metric->"count-down" + 1);
|
:set ($Metric->"count-down") ($Metric->"count-down" + 1);
|
||||||
|
:set ($Metric->"count-up") 0;
|
||||||
:set ($Metric->"parent") ($HostInfo->"parent");
|
:set ($Metric->"parent") ($HostInfo->"parent");
|
||||||
:set ($Metric->"since") ($HostVal->"since");
|
:set ($Metric->"since") ($HostVal->"since");
|
||||||
:local CountDown [ $IfThenElse ([ :tonum ($HostInfo->"count-down") ] > 0) ($HostInfo->"count-down") 5 ];
|
:local CountDown [ $IfThenElse ([ :tonum ($HostInfo->"count-down") ] > 0) ($HostInfo->"count-down") 5 ];
|
||||||
|
@ -167,6 +169,7 @@ $ScriptLock $0;
|
||||||
}
|
}
|
||||||
:set ($NetwatchNotify->$Name) {
|
:set ($NetwatchNotify->$Name) {
|
||||||
"count-down"=($Metric->"count-down");
|
"count-down"=($Metric->"count-down");
|
||||||
|
"count-up"=($Metric->"count-up");
|
||||||
"notified"=($Metric->"notified");
|
"notified"=($Metric->"notified");
|
||||||
"parent"=($Metric->"parent");
|
"parent"=($Metric->"parent");
|
||||||
"resolve-failed"=($Metric->"resolve-failed");
|
"resolve-failed"=($Metric->"resolve-failed");
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue