Nagios timeperiod and notification period
Asked Answered
H

3

8

I'm having troubles getting Nagios to honor a notification_period setting for a predefined timeperiod.

My timeperiod definition is called 'sleep' as in, do not notify me between midnight and 7am. it looks like this:

 define timeperiod{
    timeperiod_name sleep
    alias           Not Middle of Night
    sunday          07:00-23:59
    monday          07:00-23:59
    tuesday         07:00-23:59
    wednesday       07:00-23:59
    thursday        07:00-23:59
    friday          07:00-23:59
    saturday        07:00-23:59
    }

I've entered the directive for the hosts as follows:

define host{
    use             linux-server,host-pnp
    host_name       server.domain.com
    alias           server.domain.com
    address         xxx.33.xxx.243
    notification_period     sleep
    }

This morning I was expecting to see WARNING notifications but only after 7am. Instead, I saw them throughout the night between 23:59 last night and 7am this morning.

My understanding from the configuration is that I should NOT have received any emails during this time.

Have I overlooked something? I was hoping it would be this simple but it didn't work as expected.

Helmick answered 12/3, 2013 at 13:53 Comment(0)
H
7

I have solved this issue which stemmed from a lack of understanding of the way Nagios is configured. In short, custom service checks require custom notification_period directives if desired.

The question was asked and correctly answered in detail here:

Nagios Forum: notification_period not honoured on host config?

Helmick answered 13/3, 2013 at 17:43 Comment(1)
just a little note about the notification period for a host: This directive is used to specify the short name of the time period during which notifications of events for this host can be sent out to contacts. If a host goes down, becomes unreachable, or recoveries during a time which is not covered by the time period, no notifications will be sent out. (according to the official doc. So it doesn't concern service notificationQuintana
P
2

Just a hint. Please, check your time and time zone setting on the Nagios server. Your configuration looks fine for me.

Powel answered 13/3, 2013 at 8:15 Comment(1)
Thanks for your suggestion but the time is correct on the server.Helmick
D
1

Rather than adding it to all your service checks. You can add it to you contact or contact_group having the email addresses that should be notified during that time. I do basically the same for two different groups because we are 24X7. The US group gets the notifications during EST days, and the Asian group gets them at night. Saving everyone a lot of needless alert spam.

Drachm answered 14/3, 2013 at 2:35 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.