JeanLuc wrote:
> 
> I have created a patch in oder to add an option in mon.
> This patch adds the option "alertintervalcheck" in the block "period"
> for a group/service in the mon.cf file.
> This option redefines a different time interval when an alert is
> triggered.
> which can be used to perform more test before alert is ended
> It can be usefull to check a service more often than the "interval"
> value.
> 

I've seen that this patch was incorporated in the new version of mon :
<<
-added "failure_interval" functionality. i actually re-wrote
 the patch to make it a bit more proper, and renamed the
 parameter from "alertintervalcheck" to "failure_interval"
 for clarity.

 submitted by CHASSERIAU JeanLuc <[EMAIL PROTECTED]>
>>

It's great and I would to thank mon's author(s) for this.
Unfortunately, Jean-Luc don't have send its last patch's version which
should be proper and correct a bug that cause mon to wait for the
standard interval one time before changing to the new interval in case
of falure...

So, I send the new patch in the hope it can help.
Sorry for not have posted it before (and for my bad english :( ).


-------------
Fabien SALVI      Centre de Ressources Informatiques
                  Archamps, France -- http://www.cri74.org
                  PingOO GNU/linux distribution : http://www.pingoo.org
7c7
< # $Id: mon 1.8 Sun, 14 Jan 2001 07:42:47 -0800 trockij $
---
> # $Id: mon-patched,v 1.1.1.1 2001/06/15 17:03:21 jluc Exp $
28c28
< my $RCSID='$Id: mon 1.8 Sun, 14 Jan 2001 07:42:47 -0800 trockij $';
---
> my $RCSID='$Id: mon-patched,v 1.1.1.1 2001/06/15 17:03:21 jluc Exp $';
243a244,248
> 
> closelog;
> 
> openlog ("mon", "cons,pid", $CF{"SYSLOG_FACILITY"});
> 
248c253
< closelog;
---
> #closelog;
250c255
< openlog ("mon", "cons,pid", $CF{"SYSLOG_FACILITY"});
---
> #openlog ("mon", "cons,pid", $CF{"SYSLOG_FACILITY"});
359,360c364,365
<     $i++;
<     $tm = time;
---
>       $i++;
>       $tm = time;
376a382,410
>               # Redefine the value of interval if a service is down
>               # In the configuration file use : newinterval in period block. 
>               # CHASSERIAU JeanLuc <[EMAIL PROTECTED]>
>               #
>               # Description of the flag : _new_alert_interval_flag 
>               # 0 -> newinterval undefined
>               # 1 -> newinterval defined but interval unchanged
>               # 2 -> newinterval defined and interval changed
> 
>               if( ($sref->{"_op_status"} == $STAT_FAIL) &&
>                   ($sref->{"_new_alert_interval_flag"} == 1) )
>               {
>                       syslog('info',"Change value of interval to 
>".$sref->{"newinterval"}." for ".$group."/".$service);
>                       $sref->{"_old_interval"} = $sref->{"interval"};
>                       $sref->{"interval"} = $sref->{"newinterval"};
>                       $sref->{"_new_alert_interval_flag"} = 2;
> 
>                       $sref->{"_timer"} = $sref->{"newinterval"};
>                       $sref->{"_next_check"} = time + $sref->{"newinterval"};
>                       
>               }
>               if( ($sref->{"_op_status"} == $STAT_OK) &&
>                   ($sref->{"_new_alert_interval_flag"} == 2) )
>               {
>                       syslog('info',"Change value of interval to old 
>".$sref->{"_old_interval"}." for ".$group."/".$service);
>                       $sref->{"interval"} = $sref->{"_old_interval"};
>                       $sref->{"_new_alert_interval_flag"} = 1;
>               }
>       
1090a1125,1129
>           
>           $sref->{"newinterval"} = undef;
>           $sref->{"_new_alert_interval_flag"} = 0;
>           $sref->{"_old_interval"} = undef;
> 
1192a1232,1236
>       
>       elsif ($var eq "newinterval" && !$period)
>       {
>           return "cf error: need to specify a period for newinterval, line 
>$line_num";
>       }
1222a1267,1277
>           elsif ($var eq "newinterval")
>           {
>               if (!($args = dhmstos ($args))) {
>                       close (CFG);
>                       return "cf error: invalid interval '$args' (syntax: 
>newinterval = {positive number}{smhd}), line $line_num";
>               }
>               $sref->{"newinterval"} = $args;
>               $sref->{"_new_alert_interval_flag"} = 1;
>               $sref->{"_old_interval"} = 0;
>           }
> 
1285,1290c1340,1347
<                   if (($p1 - 1) * $sref->{"interval"} >= dhmstos($p2))
<                   {
<                       close (CFG);
<                       return "cf error:  interval & alertafter not sensible. No 
alerts can be generated with those parameters, line $line_num";
<                   }
<                   $pref->{"alertafter"} = $p1;
---
>                   
>                       if(($p1 - 1) * $sref->{"interval"} >= dhmstos($p2))
>                       {
>                               #close (CFG);
>                               syslog('info',"cf WARNING: interval & alertafter not 
>sensible. No alerts can be generated with those parameters, line $line_num");
>                       }
>                       
>                       $pref->{"alertafter"} = $p1;
1383a1441
>     $str = lc($str); # LowerCase 

Reply via email to