Not Sending Notification Emails

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.
Locked
onlyme
Posts: 6
Joined: Wed Dec 09, 2015 5:22 am

Not Sending Notification Emails

Post 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?
rkennedy
Posts: 6579
Joined: Mon Oct 05, 2015 11:45 am

Re: Not Sending Notification Emails

Post 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?
Former Nagios Employee
onlyme
Posts: 6
Joined: Wed Dec 09, 2015 5:22 am

Re: Not Sending Notification Emails

Post by onlyme »

Thanks, that done it!

How stupid of me!! :oops: :oops: :lol:
bwallace
Posts: 1145
Joined: Tue Nov 17, 2015 1:57 pm

Re: Not Sending Notification Emails

Post 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.
Be sure to check out the Knowledgebase for helpful articles and solutions!
Locked