Re: broken no_comp_alerts

2004-06-24 Thread Jim Trocki
On Wed, 23 Jun 2004, Daniel Fenert wrote:

> Recently I was flooded by upalerts, and found the cause, I think that
> no_comp_alerts was made up in mind, but wasn't finished in the code :)
> 
> Here's the patch (aplies cleanly on -47, I haven't checked other realeases)

thanks. i've merged them into the mon-1-0-0pre1 cvs branch, and with
the testing i've done it seems to work better.


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


broken no_comp_alerts

2004-06-22 Thread Daniel Fenert
Recently I was flooded by upalerts, and found the cause, I think that
no_comp_alerts was made up in mind, but wasn't finished in the code :)

Here's the patch (aplies cleanly on -47, I haven't checked other realeases)

-- 
Daniel Fenert --==> [EMAIL PROTECTED] <==--
==-P o w e r e d--b y--S l a c k w a r e-=-ICQ #37739641-==
One good reason why computers can do more work than people is that they
never have to stop and answer the phone.
===- http://daniel.fenert.net/ -===< +48604628083 >
--- mon-0.99.3-47/mon   2004-06-04 14:35:22.0 +0200
+++ mon/mon 2004-06-21 13:33:10.0 +0200
@@ -571,6 +571,14 @@
}
 
#
+   # skip looping upalerts when "no_comp-alerts" set.
+   #
+   if ($pref->{"no_comp_alerts"} && ($flags & $FL_UPALERT) && 
($pref->{"no_comp_alerts_upalert_sent"}>0))
+   {
+   next;
+   }
+
+   #
# do this if we're not handling an upalert or startupalert
#
if (!($flags & $FL_UPALERT) && !($flags & $FL_STARTUPALERT))
@@ -719,7 +727,19 @@
 }
 else {
 $pref->{"_alert_sent"}++;
+
+#
+# reset no_comp_alerts_upalert_sent counter - when service will be
+# back up, upalert will be sent.
+#
+   if ($pref->{"no_comp_alerts"}) {
+   $pref->{"no_comp_alerts_upalert_sent"} = 0;
+   }
 }
+
+   if ($pref->{"no_comp_alerts"} && ($flags & $FL_UPALERT)) {
+   $pref->{"no_comp_alerts_upalert_sent"}++;
+   }
 }
 }
 }
@@ -1244,6 +1264,7 @@
$pref->{"numalerts"} = 0;
$pref->{"_alert_sent"} = 0;
$pref->{"no_comp_alerts"} = 0;
+   $pref->{"no_comp_alerts_upalert_sent"} = 0;
@{$pref->{"alerts"}} = ();
@{$pref->{"upalerts"}} = ();
@{$pref->{"startupalerts"}} = ();
___
mon mailing list
[EMAIL PROTECTED]
http://linux.kernel.org/mailman/listinfo/mon