Page 1 of 1

Not Sending Notification Emails

Posted: Mon Jan 18, 2016 10:43 am
by onlyme
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?

Re: Not Sending Notification Emails

Posted: Mon Jan 18, 2016 1:04 pm
by rkennedy
See this page - https://assets.nagios.com/downloads/nag ... tions.html
If you specify n (none) as an option, the contact will not receive any type of service notifications.
I believe the n flag in your configuration is the reason you aren't seeing notifications.

Code: Select all

host_notification_options d,u,r,f,s,n
service_notification_options w,u,c,r,f,s,n
Can you try removing it, restart your nagios process, and let us know if that fixes it?

Re: Not Sending Notification Emails

Posted: Tue Jan 19, 2016 5:25 am
by onlyme
Thanks, that done it!

How stupid of me!! :oops: :oops: :lol:

Re: Not Sending Notification Emails

Posted: Tue Jan 19, 2016 10:49 am
by bwallace
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.