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.000000000 +0200
+++ mon/mon     2004-06-21 13:33:10.000000000 +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

Reply via email to