Notification and check period

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.
Post Reply
asfd
Posts: 2
Joined: Wed Apr 08, 2020 10:42 am

Notification and check period

Post 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:
bbahn
Posts: 382
Joined: Thu Jan 12, 2023 5:42 pm

Re: Notification and check period

Post 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
Actively advancing awesome answers with ardent alliteration, aptly addressing all ambiguities. Amplify your acumen and avail our amicable assistance. Eagerly awaiting your astute assessments of our advice.
asfd
Posts: 2
Joined: Wed Apr 08, 2020 10:42 am

Re: Notification and check period

Post 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
bbahn
Posts: 382
Joined: Thu Jan 12, 2023 5:42 pm

Re: Notification and check period

Post 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.
Actively advancing awesome answers with ardent alliteration, aptly addressing all ambiguities. Amplify your acumen and avail our amicable assistance. Eagerly awaiting your astute assessments of our advice.
Post Reply