timeperiod not behaving as expected

Carl Karsten carl at personnelware.com
Wed Jul 28 16:02:55 CEST 2010


I made that change, and also backed the end of the period off a min to
avoid the race between the check and the ifdown.  /etc/init.d/nagios
reload, still got an email every hour it was down:

first: Date/Time: Tue Jul 27 20:03:34 CDT 2010
last: Date/Time: Wed Jul 28 05:03:34 CDT 2010
recovery notice: Date/Time: Wed Jul 28 06:03:34 CDT 2010

define timeperiod{
        timeperiod_name credit_card_hours
        alias           when credit cards can be processed

        sunday          06:00-19:59
        monday          06:00-19:59
        tuesday         06:00-19:59
        wednesday       06:00-19:59
        thursday        06:00-19:59
        friday          06:00-19:59
        saturday        06:00-19:59
        }



define host{
        use                             linux-server    ; This
template inherits other values from the generic-host template
        host_name                       mcve.cteusa.com         ; The
name of this host
        hostgroups                      linux-servers
        check_period                    credit_card_hours
        check_interval                  5               ; Actively
check the host every 5 minutes
        retry_interval                  1               ; Schedule
host check retries at 1 minute intervals
        max_check_attempts              10              ; Check each
Linux host 10 times (max)
        check_command                   check-host-alive ; Default
command to check Linux hosts
        notification_period             credit_card_hours
        notification_interval           60
        notification_options            d,u,r           ; Only send
notifications for specific host states
        contact_groups                  admins          ;
Notifications get sent to the admins by default
        register                        1
        }

define service{
        use             generic-service         ; Inherit default
values from a template
        host_name               mcve.cteusa.com
        service_description     SMTP
        check_command   check_smtp!-t 5
        }


On Tue, Jul 27, 2010 at 4:50 PM, Assaf Flatto <nagios at flatto.net> wrote:
> Carl
>
> You have the right idea but wrong setup .
> What you want to do it check : credit_card_hours .
> and notification changed to  : credit_card_hours , that means it will
> only alert you in the hours that it is not " administratively down".
>
> so have these directives changed :
>
> notification_period     credit_card_hours
>
> check_period    credit_card_hours
>
> that should solve your alerts issue.
>
> Assaf
> Carl Karsten wrote:
>> So I took over someone's nagios setup - it works fine except it checks
>> that a box is up 24x7 but the box has a cronjob that does 0600 ifup,
>> 2000 ifdown;  so I get a wad of email every night telling me the box
>> is down, and then the resolved when it comes back up.  So I tried to
>> fix it, and now I get more email.
>>
>> Here is a diff of what I changed, my credit_card_hours, and the part
>> of server.cfg that I think is relevant.
>>
>> juser at four:~/temp$ diff nag0.txt nag1.txt
>> 1d0
>> <
>> 6c5
>> <         check_period                    24x7            ; By
>> default, Linux hosts are checked round the clock
>> ---
>>
>>>         check_period                    credit_card_hours
>>>
>> 12,14c11,12
>> <                                                         ; Note that
>> the notification_period variable is being overridden from
>> <                                                         ; the value
>> that is inherited from the generic-host template!
>> <         notification_interval           60              ; Resend
>> notifications every 2 hours
>> ---
>>
>>>         notification_interval           60
>>>
>>
>>
>> define timeperiod{
>>         timeperiod_name credit_card_hours
>>         alias           when credit cards can be processed
>>
>>         sunday          06:00-20:00
>>         monday          06:00-20:00
>>         tuesday         06:00-20:00
>>         wednesday       06:00-20:00
>>         thursday        06:00-20:00
>>         friday          06:00-20:00
>>         saturday        06:00-20:00
>>
>>
>> define host{
>>         use                             linux-server    ; This
>> template inherits other values from the generic-host template
>>         host_name                       mcve.cteusa.com         ; The
>> name of this host
>>         hostgroups                      linux-servers
>>         check_period                    credit_card_hours
>>         check_interval                  5               ; Actively
>> check the host every 5 minutes
>>         retry_interval                  1               ; Schedule
>> host check retries at 1 minute intervals
>>         max_check_attempts              10              ; Check each
>> Linux host 10 times (max)
>>         check_command                   check-host-alive ; Default
>> command to check Linux hosts
>>         notification_period             24x7    ; Linux admins hate to
>> be woken up, so we only notify during the day
>>
>>         notification_interval           60
>>         notification_options            d,u,r           ; Only send
>> notifications for specific host states
>>         contact_groups                  admins          ;
>> Notifications get sent to the admins by default
>>         register                        1
>>         }
>>
>> define service{
>>         use             generic-service         ; Inherit default
>> values from a template
>>         host_name               mcve.cteusa.com
>>         service_description     SMTP
>>         check_command   check_smtp!-t 5
>>         }
>> define service{
>>         use             generic-service         ; Inherit default
>> values from a template
>>         host_name               mcve.cteusa.com
>>         service_description     SSH
>>         check_command   check_ssh
>>         }
>> define service{
>>         use                             generic-service         ; Name
>> of service template to use
>>         host_name                       mcve.cteusa.com
>>         service_description             PING
>>         check_command                   check_ping!100.0,20%!500.0,60%
>>         }
>>
>>
>>
>
>
> ------------------------------------------------------------------------------
> The Palm PDK Hot Apps Program offers developers who use the
> Plug-In Development Kit to bring their C/C++ apps to Palm for a share
> of $1 Million in cash or HP Products. Visit us here for more details:
> http://ad.doubleclick.net/clk;226879339;13503038;l?
> http://clk.atdmt.com/CRS/go/247765532/direct/01/
> _______________________________________________
> Nagios-users mailing list
> Nagios-users at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/nagios-users
> ::: Please include Nagios version, plugin version (-v) and OS when reporting any issue.
> ::: Messages without supporting info will risk being sent to /dev/null
>



-- 
Carl K

------------------------------------------------------------------------------
The Palm PDK Hot Apps Program offers developers who use the
Plug-In Development Kit to bring their C/C++ apps to Palm for a share
of $1 Million in cash or HP Products. Visit us here for more details:
http://p.sf.net/sfu/dev2dev-palm
_______________________________________________
Nagios-users mailing list
Nagios-users at lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nagios-users
::: Please include Nagios version, plugin version (-v) and OS when reporting any issue. 
::: Messages without supporting info will risk being sent to /dev/null





More information about the Users mailing list