Skip to content

Commit c3da4ed

Browse files
committed
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.
1 parent a1ef912 commit c3da4ed

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

netwatch-notify

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -143,11 +143,13 @@ $ScriptLock $0;
143143
:set Parent ($NetwatchNotify->$Parent->"parent");
144144
}
145145
}
146-
$LogPrintExit2 [ $IfThenElse ($HostInfo->"no-down-notification" != true) info debug ] $0 \
147-
("The " . $Type . " '" . $Name . "' (" . $HostDetails . ") is down for " . \
148-
$Metric->"count-down" . " checks, " . [ $IfThenElse ($ParentNotified = false) [ $IfThenElse \
149-
($Metric->"notified" = true) ("already notified.") ($CountDown - $Metric->"count-down" . \
150-
" to go.") ] ("parent " . $Type . " " . $Parent . " is down.") ]) false;
146+
:if ($Metric->"notified" = false || $Metric->"count-down" % 120 = 0) do={
147+
$LogPrintExit2 [ $IfThenElse ($HostInfo->"no-down-notification" != true) info debug ] $0 \
148+
("The " . $Type . " '" . $Name . "' (" . $HostDetails . ") is down for " . \
149+
$Metric->"count-down" . " checks, " . [ $IfThenElse ($ParentNotified = false) [ $IfThenElse \
150+
($Metric->"notified" = true) ("already notified.") ($CountDown - $Metric->"count-down" . \
151+
" to go.") ] ("parent " . $Type . " " . $Parent . " is down.") ]) false;
152+
}
151153
:if ((($CountDown * 2) - ($Metric->"count-down" * 3)) / 2 = 0 && \
152154
[ :typeof ($HostInfo->"pre-down-hook") ] = "str") do={
153155
$NetwatchNotifyHook $Name $Type "pre-down" ($HostInfo->"pre-down-hook");

0 commit comments

Comments
 (0)