Page 1 of 1

Nagios not sending email notifications

Posted: Mon Apr 13, 2015 8:13 pm
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$"

Re: Nagios not sending email notifications

Posted: Tue Apr 14, 2015 8:52 am
by jdalrymple
Is the nagios user able to execute that binary?

Code: Select all

/usr/local/bin/sendEmail
Is selinux enabled?

Re: Nagios not sending email notifications

Posted: Tue Apr 14, 2015 8:56 am
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.

Re: Nagios not sending email notifications

Posted: Tue Apr 14, 2015 9:00 am
by lmiltchev
I'm glad your issue has been resolved! I am locking this topic.