Can't Get Host Notifications To Work
Posted: Thu Jun 15, 2017 4:19 pm
I've looked through the documentation extensively and cannot figure out why my service status notifications are working 100% of the time and my host status notifications are not working 100% of the time.
All the services in question use this template. I always get notifications on these.
All hosts uses these templates. I never get notifications on these.
The only notification setting I can see that differs is "notification_options" and per the documentation it seems like these should be different for hosts vs services. I am not overriding any notification* or contact* parameters in individual host or service definitions inherited from these templates.
The template for the contact seems to have both host and service notifications enabled:
And the command definitions for notify-service-by-email and notify-host-by-email seem reasonably similar, ultimately just using /bin/mail to email $CONTACTEMAIL$
I'm not seeing anything in nagios.log to indicate that it's trying to send a host down notification and encountering an error.
Can anyone point out what I'm overlooking here or how I might further debug what's happening here?
All the services in question use this template. I always get notifications on these.
Code: Select all
define service{
name generic-service
active_checks_enabled 1
passive_checks_enabled 1
parallelize_check 1
obsess_over_service 1
check_freshness 0
notifications_enabled 1
event_handler_enabled 1
flap_detection_enabled 1
failure_prediction_enabled 1
process_perf_data 1
retain_status_information 1
retain_nonstatus_information 1
is_volatile 0
check_period 24x7
max_check_attempts 3
normal_check_interval 10
retry_check_interval 2
contact_groups admins
notification_options w,u,c,r
notification_interval 0
notification_period 24x7
register 0
}
Code: Select all
define host{
name generic-host
notifications_enabled 1
event_handler_enabled 1
flap_detection_enabled 1
failure_prediction_enabled 1
process_perf_data 1
retain_status_information 1
retain_nonstatus_information 1
notification_period 24x7
register 0
}
define host{
name linux-server
use generic-host
check_period 24x7
check_interval 5
retry_interval 1
max_check_attempts 10
check_command check-host-alive
notification_period 24x7
notification_interval 0
notification_options d,u,r
contact_groups admins
register 0
}
The template for the contact seems to have both host and service notifications enabled:
Code: Select all
define contact{
name generic-contact
service_notification_period 24x7
host_notification_period 24x7
service_notification_options w,u,c,r,f,s
host_notification_options d,u,r,f,s
service_notification_commands notify-service-by-email
host_notification_commands notify-host-by-email
register 0
}
Code: Select all
define command{
command_name notify-host-by-email
command_line /usr/bin/printf "%b" "***** Nagios *****\n\nNotification Type: $NOTIFICATIONTYPE$\nHost: $HOSTNAME$\nState: $HOSTSTATE$\nAddress: $HOSTADDRESS$\nInfo: $HOSTOUTPUT$\n\nDate/Time: $LONGDATETIME$\n" | /bin/mail -s "** $NOTIFICATIONTYPE$ Host Alert: $HOSTNAME$ is $HOSTSTATE$ **" $CONTACTEMAIL$
}
define command{
command_name notify-service-by-email
command_line /usr/bin/printf "%b" "***** Nagios *****\n\nNotification Type: $NOTIFICATIONTYPE$\n\nService: $SERVICEDESC$\nHost: $HOSTALIAS$\nAddress: $HOSTADDRESS$\nState: $SERVICESTATE$\n\nDate/Time: $LONGDATETIME$\n\nAdditional Info:\n\n$SERVICEOUTPUT$\n" | /bin/mail -s "** $NOTIFICATIONTYPE$ Service Alert: $HOSTALIAS$/$SERVICEDESC$ is $SERVICESTATE$ **" $CONTACTEMAIL$
}
Can anyone point out what I'm overlooking here or how I might further debug what's happening here?