mirror of
https://github.com/eworm-de/routeros-scripts
synced 2024-05-14 08:04:19 +00:00
netwatch-notify: stop flooding the log after down notification
This will now log all messages before notification, and every two hours (or scheduler interval * 120) after.
This commit is contained in:
parent
a1ef912ec7
commit
c3da4ed696
1 changed files with 7 additions and 5 deletions
|
@ -143,11 +143,13 @@ $ScriptLock $0;
|
||||||
:set Parent ($NetwatchNotify->$Parent->"parent");
|
:set Parent ($NetwatchNotify->$Parent->"parent");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$LogPrintExit2 [ $IfThenElse ($HostInfo->"no-down-notification" != true) info debug ] $0 \
|
:if ($Metric->"notified" = false || $Metric->"count-down" % 120 = 0) do={
|
||||||
("The " . $Type . " '" . $Name . "' (" . $HostDetails . ") is down for " . \
|
$LogPrintExit2 [ $IfThenElse ($HostInfo->"no-down-notification" != true) info debug ] $0 \
|
||||||
$Metric->"count-down" . " checks, " . [ $IfThenElse ($ParentNotified = false) [ $IfThenElse \
|
("The " . $Type . " '" . $Name . "' (" . $HostDetails . ") is down for " . \
|
||||||
($Metric->"notified" = true) ("already notified.") ($CountDown - $Metric->"count-down" . \
|
$Metric->"count-down" . " checks, " . [ $IfThenElse ($ParentNotified = false) [ $IfThenElse \
|
||||||
" to go.") ] ("parent " . $Type . " " . $Parent . " is down.") ]) false;
|
($Metric->"notified" = true) ("already notified.") ($CountDown - $Metric->"count-down" . \
|
||||||
|
" to go.") ] ("parent " . $Type . " " . $Parent . " is down.") ]) false;
|
||||||
|
}
|
||||||
:if ((($CountDown * 2) - ($Metric->"count-down" * 3)) / 2 = 0 && \
|
:if ((($CountDown * 2) - ($Metric->"count-down" * 3)) / 2 = 0 && \
|
||||||
[ :typeof ($HostInfo->"pre-down-hook") ] = "str") do={
|
[ :typeof ($HostInfo->"pre-down-hook") ] = "str") do={
|
||||||
$NetwatchNotifyHook $Name $Type "pre-down" ($HostInfo->"pre-down-hook");
|
$NetwatchNotifyHook $Name $Type "pre-down" ($HostInfo->"pre-down-hook");
|
||||||
|
|
Loading…
Reference in a new issue