timeperiod not behaving as expected

Carl Karsten carl at personnelware.com
Wed Jul 28 16:59:44 CEST 2010


On Wed, Jul 28, 2010 at 10:35 AM, Assaf Flatto <nagios at flatto.net> wrote:
> Carl Karsten wrote:
>> On Wed, Jul 28, 2010 at 10:15 AM, Assaf Flatto <nagios at flatto.net> wrote:
>>
>>> Carl Karsten wrote:
>>>
>>>> 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
>>>>         }
>>>>
>>>>
>>>>
>>> You'll need to define the check time and notification time for the
>>> services too .
>>>
>>>
>>>
>>
>> I figured it was something like that.    There are only 3, but it
>> seems like I should use a template.  is there a recommended place?
>> (timeperiods, linuxservers.cfg...)
>>
>>
>>
> Personally i have a file called servicetemplates.cfg  .
>

how does this look:

/usr/local/nagios/etc/objects$ grep servicetemplates ../nagios.cfg
cfg_file=/usr/local/nagios/etc/objects/servicetemplates.cfg

/usr/local/nagios/etc/objects$ cat servicetemplates.cfg
# servicetemplates.cfg
define service{
        name                    credit-card-box-service
        use                     local-service         ; Inherit from that
        notification_period     credit_card_hours
        check_period            credit_card_hours
        register                0
        }

$vim linuxserver.cfg...

define service{
        use                     credit-card-box-service
        host_name               mcve.cteusa.com
        service_description     SMTP
        check_command           check_smtp!-t 5
        }

-- 
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