The alertafter <time interval> syntax doesn't work properly because it
seems that the _1stfailtime variable is never reset after an initial
failure.

On startup, mon initializes the _1stfailtime variable to 0 for any
periods which are configured for alertafter <time interval>.
Subsequently, when a failure occurs, this variable gets set to the
current UNIX timestamp.  When the (current time - the 1stfailtime)
exceeds the configured time interval, a DOWN alert is thrown.

Problem is, since 1stfailtime is never cleared, ever subsequent
failure will cause a DOWN alert to be thrown immediately, because
1stfailtime is past the current time - <time interval>.

Patch against mon-0.99.2:

--- mon.orig    Sat Sep  8 09:42:05 2001
+++ mon Sun Dec  1 08:28:48 2002
@@ -2879,12 +2879,13 @@
            $sref->{"_last_detail"} = $detail;

            #
-           # reset the alertevery timer
+           # reset the alertevery timer, and alertafter interval timer
            #
            foreach my $period (keys %{$sref->{"periods"}})
            {
                $sref->{"periods"}->{$period}->{"_last_alert"} = 0;
                $sref->{"periods"}->{$period}->{"_alert_sent"} = 0;
+               $sref->{"periods"}->{$period}->{"_1stfailtime"} = 0;
            }

            #

--
Adrian Chung (adrian at enfusion-group dot com)
http://www.enfusion-group.com/~adrian/
GPG Fingerprint: C620 C8EA 86BA 79CC 384C E7BE A10C 353B 919D 1A17
[gambit.enfusion-group.com] 4:29pm up 16 days, 11:49, 2 users

_______________________________________________
mon mailing list
[EMAIL PROTECTED]
http://linux.kernel.org/mailman/listinfo/mon

Reply via email to