I am having a problem getting Nagios to send email notifications. I am running on Ubuntu 7.04. I am using Nagios 2.10 and sendmail.
I am able to send an email by typing /usr/bin/mail -s "test" email@example.com
After I type this line, the terminal waits for more input. I can press d and I am prompted for Cc:
I then press enter and get the mesage "Null message body; hope that's ok"
The terminal then waits for more input. I can exit out by typing z
I then get "+ Stopped /usr/bin/mail -s "test" firstname.lastname@example.org"
The problem I am having is with nagios sending email. It is timing out after 60 seconds.
I get the following in my log files (edited of course)
[04-16-2008 18:13:56] Warning: Contact 'bdudley' host notification command '/usr/bin/printf "%b" "Host 'Motorclub3 - 4796' is DOWN\nInfo: PING CRITICAL - Packet loss = 100%\nTime: Wed Apr 16 18:12:55 CDT 2008" | /usr/bin/mail -s "PROBLEM alert - Host 4796 is DOWN" email@example.com' timed out after 60 seconds
Host Notification[04-16-2008 18:12:55] HOST NOTIFICATION: bdudley;4796;DOWN;host-notify-by-epager;PING CRITICAL - Packet loss = 100%
My script for sending the notifications is as follows.
command_line /usr/bin/printf "%b" "***** Nagios 2.10 *****\n\nNotification Type: $NOTIFICATIONTYPE$\nHost: $HOSTNAME$\nState: $HOSTSTATE$\nAddress: $HOSTADDRESS$\nInfo: $HOSTOUTPUT$\n\nDate/Time: $LONGDATETIME$\n" | /usr/bin/mail -s "Host $HOSTSTATE$ alert for $HOSTNAME$!" $CONTACTEMAIL$
I know that I am missing something, probably real simple, but I am not sure what. Should there be a command to enter the d and z? I am pretty sure that it is timing out on the parts where /usr/bin/mail was waiting on a terminal input, but I do not know how to fix it. Any suggestions will be appreciated as I have been going over this for 2 days now.