Timeperiod Assistance

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
Locked
and1100
Posts: 93
Joined: Mon Mar 25, 2013 8:37 am

Timeperiod Assistance

Post by and1100 »

Hello,

My goal is to have notifications for a specific host be sent out only during the hours of 6AM est and 5pm est, Monday through Friday. All other hours will not send any alerts. I have defined the following timeperiod in timeperiods.cfg

Code: Select all

define timeperiod{
        timeperiod_name test-uptime
        alias           Uptime Hours

        use             us-holidays             ; Get holiday exceptions from other timeperiod

        monday          06:01-17:00
        tuesday         06:01-17:00
        wednesday       06:01-17:00
        thursday        06:01-17:00
        friday          06:01-17:00
        }
In my linux.cfg, for the host, it looks as follows:

Code: Select all

define host{
        use                     linux-server
        host_name               testserver
        alias                   teserver
        address                 x.x.x.x
        hostgroups              linux
        max_check_attempts      2
        notification_interval   30
        notification_period     test-uptime
        hostgroups              testgroup
        contacts                blah
        }
As I was going through the configs accumulating the information, I may have realized my error. Do I need to define the notification_period for each specific service that is being checked?

Thanks.
and1100
Posts: 93
Joined: Mon Mar 25, 2013 8:37 am

Re: Timeperiod Assistance

Post by and1100 »

Also, if do need to add notification_period for the specific servers, how would I then only do it for one specific server in a hostgroup. Would I need to create a separate service check separate from the hostgroup for that one host?
abrist
Red Shirt
Posts: 8334
Joined: Thu Nov 15, 2012 1:20 pm

Re: Timeperiod Assistance

Post by abrist »

and1100 wrote:Do I need to define the notification_period for each specific service that is being checked?
Only if you need to override host/template settings, otherwise you could set the timeperiod on the host or on the template.
and1100 wrote:Would I need to create a separate service check separate from the hostgroup for that one host?
Not necessarily. Settings on the object itself will override settings on the hostgroup/etc. Basically, the closer you are to the host/service object, the higher precedence your settings take.
Former Nagios employee
"It is turtles. All. The. Way. Down. . . .and maybe an elephant or two."
VI VI VI - The editor of the Beast!
Come to the Dark Side.
and1100
Posts: 93
Joined: Mon Mar 25, 2013 8:37 am

Re: Timeperiod Assistance

Post by and1100 »

Hi abrist,

Thank you for the response and information. I have set the timeperiod on the host definition but I still seem to be receiving the alerts when I'd like them to be suppressed.

I double checked the configuration in the GUI has well and it looks to have stuck for the host:


Time Period test-uptime
Name Alias/Description Exclusions Days/Dates Times
test-uptime test Uptime Hours december 25 00:00:00 - 00:00:00
july 4 00:00:00 - 00:00:00
january 1 00:00:00 - 00:00:00
thursday 4 november 00:00:00 - 00:00:00
monday 1 september 00:00:00 - 00:00:00
monday -1 may 00:00:00 - 00:00:00
monday 06:01:00 - 17:00:00
tuesday 06:01:00 - 17:00:00
wednesday 06:01:00 - 17:00:00
thursday 06:01:00 - 17:00:00
friday 06:01:00 - 17:00:00

Is there something I am not seeing?

Thank you!
slansing
Posts: 7698
Joined: Mon Apr 23, 2012 4:28 pm
Location: Travelling through time and space...

Re: Timeperiod Assistance

Post by slansing »

No that looks fine to me, can you verify your configuration and show us the output?:

Code: Select all

/usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg
Also, you are sure that you restarted nagios correct?
and1100
Posts: 93
Joined: Mon Mar 25, 2013 8:37 am

Re: Timeperiod Assistance

Post by and1100 »

Hi - yep I have definitely restarted Nagios.

Combing through the configs again.

Thank you.
slansing
Posts: 7698
Joined: Mon Apr 23, 2012 4:28 pm
Location: Travelling through time and space...

Re: Timeperiod Assistance

Post by slansing »

Are you just testing this with the host? You will want to assign the time period to either your services, or your contact(s)/groups that are assigned to them as well to suppress those notifications.
Locked