On 7/23/07, Nicolas KOWALSKI <[EMAIL PROTECTED]> wrote:
> Hello,
>
> I noticed that "no_comp_alerts" does not work in the following configuration:
>
> watch HOSTGROUP
>      service SVC
>         interval 5m
>         monitor MONITOR
>         period failure: wd{mon-fri} hr{8-18}
>             alert wh-file.alert
>         period up: wd{mon-sun}
>             no_comp_alerts
>             upalert wh-file.alert
>
>
> Looking in the code and logs, I found that
> _no_comp_alerts_upalert_sent is never reset to zero when no alert
> script is called. So upalerts are sent only once (at startup or
> reset).
>
> The following patch against mon 1.2.0 seems to correct this, by
> forcing the reset as soon as possible:
>
> --- mon.orig    2007-07-23 17:37:10.988935200 +0200
> +++ mon 2007-07-23 17:38:34.916224800 +0200
> @@ -666,6 +666,18 @@
>
>         my $pref = \%{$sref->{"periods"}->{$periodlabel}};
>
> +        #
> +       # Reset no_comp_alerts counter if ALERT
> +       #
> +       if ($pref->{"no_comp_alerts"} &&
> +           $pref->{"_no_comp_alerts_upalert_sent"} > 0 &&
> +           !($flags & 
> ($FL_UPALERT|$FL_ACKALERT|$FL_DISABLEALERT|$FL_ENABLEALER
> +T))) {
> +           syslog('debug',"$group/$service/$periodlabel: ALERT, 
> no_comp_alerts
> +reset");
> +           $pref->{"_no_comp_alerts_upalert_sent"} = 0;
> +       }
> +
>         #
>         # skip upalerts/ackalerts not paired with down alerts
>         # disable by setting "no_comp_alerts" in period section
>
>
> Does it look reasonable ?

Anyone about it ?


Without this patch, we have to use the following workaround, which is
a bit ugly:

watch HOSTGROUP
     service SVC
        interval 5m
        monitor MONITOR
        period failure: wd{mon-fri} hr{8-18}
            alert wh-file.alert
        period up: wd{mon-sun}
            no_comp_alerts
            alert fake.alert
            upalert wh-file.alert

fake.alert is an alert script doing nothing.


Thanks,
-- 
Nicolas

_______________________________________________
mon mailing list
[email protected]
http://linux.kernel.org/mailman/listinfo/mon

Reply via email to