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.
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.
Is the clock right on the nagios server?
Do you have time periods setup on the service checks?
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.
Yes, the time is correct. I double-checked it against an NTP server and it matches other servers to.
Regarding the service checks, do I need to specify the notification_period directive for each service check within the host.cfg file? I might be mistaken but I thought I could simply apply the directive once in the host.cfg file. For example, what if a host has up to 20 service checks?
Do the service checks have the same notification time period as the host check?
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.
define host{
name generic-host ; The name of this host template
notifications_enabled 1 ; Host notifications are enabled
event_handler_enabled 1 ; Host event handler is enabled
flap_detection_enabled 1 ; Flap detection is enabled
failure_prediction_enabled 1 ; Failure prediction is enabled
process_perf_data 1 ; Process performance data
retain_status_information 1 ; Retain status information across program restarts
retain_nonstatus_information 1 ; Retain non-status information across program restarts
notification_period 24x7 ; Send host notifications at any time
register 0 ; DONT REGISTER THIS DEFINITION - ITS NOT A REAL HOST, JUST A TEMPLATE!
}
notification_period workhours ; Linux admins hate to be woken up, so we only notify during the day
; Note that the notification_period variable is being overridden from
; the value that is inherited from the generic-host template!
So, it looks like the object inheritance to the generic-host template is overriding the the custom value for my host server.domain.com. As in, it's not honouring my custom config for that particular host, but still retrieving the notify 24x7 value from the template.
You could create a different host template without the notification time periods. Does your generic-service template have any notification time periods set?
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.
But... I would have thought that if we have a notification_period directive on the child (in this case the host config) it would override the service checks on each?
I guess what I'm asking is if the child (server.domain.com.cfg) has a custom directive, shouldn't that override the notifications for service checks on that host? It seems odd that I would need to create custom templates for one-off situations where I only want a couple of hosts to have custom directives (in this case notifications).
Perhaps this is the way the inheritance works. Is that the case?
Does the child override the parent? Or the parent override the child?
IE:
server.domain.com.cfg custom directive is overridden by whats in templates.cfg
or
templates.cfg custom directive is overridden by whats in server.domain.com.cfg
Normally you have to either explicitly specify the value of a required variable in an object definition or inherit it from a template. There are a few exceptions to this rule, where Nagios will assume that you want to use a value that instead comes from a related object. For example, the values of some service variables will be copied from the host the service is associated with if you don't otherwise specify them.
Essentially, the service checks will only inherit the host settings if they are not defined on the service.
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.