I am having the same problem with Nagios and Ubuntu. I am trying to get E-Mail notifications working in Nagios as well. I have configured Nagios to monitor 20 hosts and over 60 services. I am running Nagios on Ubuntu 7.10 and I am extremly impressed with the flexibility of the system.
The problem is that I cannot for the life of me get E-Mail notifications working. I have the following configurations.
service_description C-Card Gateway
alias Jim A
command_line /usr/bin/printf "%b" "***** Nagios *****\n\nNotification Type: $NOTIFICATIONTYPE$\nHost: $HOSTNAME$\nState: $HOSTSTATE$\nAddress: $HOSTADDRESS$\nInfo: $HOSTOUTPUT$\n\nDate/Time: $LONGDATETIME$\n" | /usr/bin/mailx -s "** $NOTIFICATIONTYPE$ Host Alert: $HOSTNAME$ is $HOSTSTATE$ **" $CONTACTEMAIL$
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$" | /usr/bin/mailx -s "** $NOTIFICATIONTYPE$ Service Alert: $HOSTALIAS$/$SERVICEDESC$ is $SERVICESTATE$ **" $CONTACTEMAIL$
I have installed mailx and followed the Ubuntu Quickstart Guide. I found some instructions on another thread that reccomended that I change the permissions on the /usr/local/nagios/var/rw/nagios.cmd file to 775. This did not make a difference.
To further troubleshoot the issue I looked at the nagios.log file and noticed the following message that I thought was relevant,
 SERVICE NOTIFICATION: nagiosadmin;host1;T.I.A.;CRITICAL;notify-service-by-email;Connection refused
 SERVICE NOTIFICATION: jarm;host1;T.I.A.;CRITICAL;notify-service-by-email;Connection refused