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.

Mike J
  • 1,200
  • 6
  • 20
  • 31

3 Answers3

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?

Mike J
  • 1,200
  • 6
  • 20
  • 31
  • 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](http://nagios.sourceforge.net/docs/3_0/objectdefinitions.html#host). So it doesn't concern service notification – Labynocle Aug 02 '13 at 08:06
2

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

Guardian
  • 68
  • 5
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.

Jim Black
  • 1,422
  • 1
  • 13
  • 26