mirror of
https://github.com/eworm-de/routeros-scripts.git
synced 2025-08-03 17:54:36 +02:00
netwatch-notify: implemented simple dependency model
This commit is contained in:
parent
e1d9b08b9a
commit
6c14412aa9
2 changed files with 17 additions and 4 deletions
|
@ -48,8 +48,12 @@
|
|||
:set ($Metric->"since") ($HostVal->"since");
|
||||
$LogPrintExit info ("Host " . $HostName . " (" . $HostVal->"host" . ") is down for " . \
|
||||
$Metric->"count" . " checks.") false;
|
||||
:if ($Metric->"count" >= [ $IfThenElse ([ :typeof ($HostInfo->"count") ] != "nothing") ($HostInfo->"count") 5 ] && \
|
||||
$Metric->"notified" != true) do={
|
||||
:local Count [ $IfThenElse ([ :tonum ($HostInfo->"count") ] > 0) ($HostInfo->"count") 5 ];
|
||||
:local ParentNotified [ $IfThenElse (($NetwatchNotify->($HostInfo->"parent")->"notified") = true) true false ];
|
||||
:if ([ :len ($HostInfo->"parent") ] > 0) do={
|
||||
:set Count ($Count + 1);
|
||||
}
|
||||
:if ($ParentNotified = false && $Metric->"count" >= $Count && $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;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue