Page 1 of 1

Notification and check period

Posted: Tue Jul 02, 2024 10:29 am
by asfd
Hello,

I have a few routers being moontored with nagios, thing is that I would like to know how to allow that a single host (or hostgroup) check 24x7 but only alert me during the notification period I want.

I been testing and no good results till now.
Tried to add in the host definition
check_period timeperiod_that_applies
notification_period timeperiod_that_applies

The error I get when I check config is:
Error: Failed to locate notification_period 'timeperiod_that_applies' for host 'the_monitored_host!

Hope to get some ideas to solve it. :roll:

Re: Notification and check period

Posted: Tue Jul 02, 2024 10:41 am
by bbahn
Hello @asfd,

How have you defined your time period?
It seems that your timeperiod_that_applies is not properly defined with Nagios Core.

You also want your check_period to be over the 24x7 time interval and the notification_period to be over your timeperiod_that_applies

Here is some documentation that may help:
Time Periods in Nagios Core
Time Period Definitions

Re: Notification and check period

Posted: Tue Jul 02, 2024 10:54 am
by asfd
Hi bbahn,

define timeperiod{
timeperiod_name timeperiod_that_applies
alias timeperiod_that_applies
monday 07:00-13:00
tuesday 07:00-13:00
wednesday 07:00-13:00
thursday 07:00-13:00
friday 07:00-13:00
saturday 07:00-13:00
sunday 07:00-13:00
}

The check period is configured in the template I made for the routers.

define host{
name mpls-host
notifications_enabled 1
event_handler_enabled 1
flap_detection_enabled 1
process_perf_data 1
retain_status_information 1
retain_nonstatus_information 1
check_period 24x7
notification_period 24x7
register 0
notification_options d,r,f,s
contact_groups rf-notificactions
check_command check-host-alive
check_interval 5
retry_interval 1
max_check_attempts 5
notification_interval 600

Re: Notification and check period

Posted: Wed Jul 03, 2024 2:01 pm
by bbahn
I assume the timeperiod is defined in timeperiods.cfg or in /usr/local/nagios/etc/imports/mytimeperiods.cfg. If not, you will need to put it in there.

Verify that with

Code: Select all

/usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg
and by going into your Nagios Core interface under System->Configuration and selecting Timeperiods and verifying that your time period is shown there and looks correct.

As for your host definition, once you verify that your timeperiod is correctly added and recognized by Nagios Core, you will need to update your notification_period from the current 24x7 to your timeperiod timeperiod_that_applies.