On Wed, 21 Nov 2001 [EMAIL PROTECTED] wrote:

> 
> How to use "exclude_period" parameter in a Mon.cf file ?
> I want to launch a specific monitor only during a certain period of the
> week (open hours).
> I tried this way :
> service Appli-BH
>      exclude_period wday {saturday sunday}, wday {monday-friday} hour
> {19-8}
>      interval 5m
>           monitor phttp.rrdrt.monitor ...
>           period  wday {monday-friday} hour {9-18}
>           alert   my-file.alert ....
>           upalert my-file.alert ...
>           period  wday {monday-friday} hour {9-18}
>           alertafter 2 9m
>           alert   my-sendtrap.alert ...
>           upalert my-sendtrap.alert ...

you can't have two periods with the exact same periodspecs without
using a label. from the man page:

              The second form requires  a  label  followed  by  a
              period  specification,  as defined above. The label
              is a tag consisting of an alphabetic  character  or
              underscore  followed  by zero or more alphanumerics
              or underscores and ending with a colon.  This  form
              allows  multiple periods with the same period defi�
              nition. One use is  to  have  a  period  definition
              which  has  no  alertafter or alertevery parameters
              for a particular time period, and another  for  the
              same  time  period  with  a different set of alerts
              that does contain those parameters.

so you'll need something like:

service Appli-BH
      exclude_period wday {saturday sunday}, wday {monday-friday} hour {19-8}
      interval 5m
      monitor phttp.rrdrt.monitor ...
      period P1: wday {monday-friday} hour {9-18}
           alert   my-file.alert ....
           upalert my-file.alert ...
      period P2: wday {monday-friday} hour {9-18}
           alertafter 2 9m
           alert   my-sendtrap.alert ...
           upalert my-sendtrap.alert ...

since the exclude_period prevents the monitor from running during the
excluded ranges, the period sections can safely have "wd {Sun-Sat}"
instead of the inverse of the exclude period.

try that out and see if it works. sometimes it's useful to make a test
alert script for debugging purposes which only appends some text (like
a date string) to a file.

> Additionnal question : use of exclude_hosts ?

the answer is in the man page.


Reply via email to