mirror of
https://git.eworm.de/cgit/routeros-scripts
synced 2025-08-03 17:54:41 +02:00
netwatch-notify: be more verbose in logs
This commit is contained in:
parent
6c14412aa9
commit
d5125b816a
1 changed files with 4 additions and 2 deletions
|
@ -46,13 +46,15 @@
|
|||
} else={
|
||||
:set ($Metric->"count") ($Metric->"count" + 1);
|
||||
:set ($Metric->"since") ($HostVal->"since");
|
||||
$LogPrintExit info ("Host " . $HostName . " (" . $HostVal->"host" . ") is down for " . \
|
||||
$Metric->"count" . " checks.") false;
|
||||
: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);
|
||||
}
|
||||
$LogPrintExit info ("Host " . $HostName . " (" . $HostVal->"host" . ") is down for " . \
|
||||
$Metric->"count" . " checks, " . [ $IfThenElse ($ParentNotified = false) [ $IfThenElse \
|
||||
($Metric->"notified" = true) ("already notified.") ($Count - $Metric->"count" . " to go.") ] \
|
||||
("parent host " . $HostInfo->"parent" . " is down.") ]) false;
|
||||
: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" . ".");
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue