Nagios not sending email notifications

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
Eroberts
Posts: 2
Joined: Mon Apr 13, 2015 6:13 pm

Nagios not sending email notifications

Post by Eroberts »

Edit: If you look at my command lines I think you might quickly spot my bonehead mistake.


Any help on this matter is greatly appreciated, please forgive any poor conventions, I'm a newb round these parts.

I can see the notification in the notifications area of nagios and it has my username as the contact but not receiving emails.

I know sendmail is working because I can send these out if I replace $CONTACTEMAIL$ with an actual email address.

Sendmail isn't logging anything when Nagios triggers a notification.

nagios log says:

[1428971405] HOST NOTIFICATION: nagiosadmin;winserver;DOWN;notify-host-by-email;PING CRITICAL - Packet loss = 100%
[1428971405] wproc: NOTIFY job 2 from worker Core Worker 2572 is a non-check helper but exited with return code 2



Here's my command:

# 'notify-host-by-email' command definition
define command{
command_name notify-host-by-email
command_line command_line /usr/local/bin/sendEmail -o tls=yes -s outlook.office365.com:587 -xu [email protected] -xp XXXX -t $CONTACTEMAIL$ -f [email protected] -l /var/log/sendEmail -u "** $NOTIFICATIONTYPE$ Host Alert: $HOSTNAME$ is $HOSTSTATE$ **" -m "***** Nagios *****\n\nNotification Type: $NOTIFICATIONTYPE$\nHost: $HOSTNAME$\nState: $HOSTSTATE$\nAddress: $HOSTADDRESS$\nInfo: $HOSTOUTPUT$\n\nDate/Time: $LONGDATETIME$\n" }
}

# 'notify-service-by-email' command definition
define command{
command_name notify-service-by-email
command_line command_line /usr/local/bin/sendEmail -o tls=yes -s outlook.office365.com:587 -xu [email protected] -xp XXXX -t $CONTACTEMAIL$ -f [email protected] -l /var/log/sendEmail -u "** $NOTIFICATIONTYPE$ Service Alert: $HOSTALIAS$/$SERVICEDESC$ is $SERVICESTATE$ **" -m "***** Nagios *****\n\nNotification Type: $NOTIFICATIONTYPE$\n\nService: $SERVICEDESC$\nHost: $HOSTALIAS$\nAddress: $HOSTADDRESS$\nState: $SERVICESTATE$\n\nDate/Time: $LONGDATETIME$\n\nAdditional Info:\n\n$SERVICEOUTPUT$"
jdalrymple
Skynet Drone
Posts: 2620
Joined: Wed Feb 11, 2015 1:56 pm

Re: Nagios not sending email notifications

Post by jdalrymple »

Is the nagios user able to execute that binary?

Code: Select all

/usr/local/bin/sendEmail
Is selinux enabled?
Eroberts
Posts: 2
Joined: Mon Apr 13, 2015 6:13 pm

Re: Nagios not sending email notifications

Post by Eroberts »

Thank you so much for responding. Look at my command line. I have command_line in there twice.

Feeling special :D

Thanks again for trying to help with this one. I showed my buddy and he caught it right away.
User avatar
lmiltchev
Bugs find me
Posts: 13589
Joined: Mon May 23, 2011 12:15 pm

Re: Nagios not sending email notifications

Post by lmiltchev »

I'm glad your issue has been resolved! I am locking this topic.
Be sure to check out our Knowledgebase for helpful articles and solutions!
Locked