Nagios not sending email notifications
Posted: Mon Apr 13, 2015 8:13 pm
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$"
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$"