I have all my services and hosts set up and Nagios is monitoring them correctly.
However I am not getting email alerts when a service or host has an alert.
I do get an email if I select Send Custom service notification in Nagios Core.
How do I get Nagios to email me when a service has a change of state.
Contacts.cfg
define contact {
contact_name nagiosadmin
alias Nagios Admin
contactgroups admins
host_notifications_enabled 1
service_notifications_enabled 1
host_notification_period 24x7
service_notification_period 24x7
host_notification_options d,u,r,f,s,n
service_notification_options w,u,c,r,f,s,n
host_notification_commands notify-host-by-email,process-host-perfdata
service_notification_commands notify-service-by-email,process-service-perfdata
email mywork@emailaccount
use generic-contact
register 1
}
Command.cfg
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$
register 1
}
Can someone help in resolving the issue please?
Not Sending Notification Emails
Re: Not Sending Notification Emails
See this page - https://assets.nagios.com/downloads/nag ... tions.html
Can you try removing it, restart your nagios process, and let us know if that fixes it?
I believe the n flag in your configuration is the reason you aren't seeing notifications.If you specify n (none) as an option, the contact will not receive any type of service notifications.
Code: Select all
host_notification_options d,u,r,f,s,n
service_notification_options w,u,c,r,f,s,n
Former Nagios Employee
Re: Not Sending Notification Emails
Thanks, that done it!
How stupid of me!!

How stupid of me!!
Re: Not Sending Notification Emails
Glad we were able to help. We'll lock this thread now and feel free to open another should you require assistance with anything else.
Be sure to check out the Knowledgebase for helpful articles and solutions!