Sign up ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

I'm very new to Nagios. I'm trying to send email alerts. But that doesn't seem to be working.

But in my log of nagios I can see this :

SERVICE ALERT: Appserver;Tmp directory;CRITICAL;HARD;1;

Where host notifications are generated via email, only service alerts are not working. And when I look at sendEmail log I can see this :

Sep 14 12:38:39 x.x.x.x. sendEmail[23005]: ERROR => You must specify a 'from' field!  Try --help.
Sep 14 12:39:39 x.x.x.x.x. sendEmail[23129]: ERROR => You must specify a 'from' field!  Try --help.
Sep 14 12:40:39 x-x-x-x-x sendEmail[23233]: ERROR => You must specify a 'from' field!  Try --help.

Where I'm making the mistake?

Thanks in advance.

share|improve this question

2 Answers 2

up vote 1 down vote accepted

You didn't specify which distro you were using on your EC2 instance, but the notify-host-by-email command definition that's on my Ubuntu Lucid box looks like:

define command{
    command_name    notify-host-by-email
    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/mail -s "$HOSTSTATE$ - $HOSTNAME$ ping"  -r "Nagios Alert <>" $CONTACTEMAIL$

and the notify-service-by-email looks like:

define command{
    command_name    notify-service-by-email
    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/mail -s "$SERVICESTATE$ $HOSTALIAS$/$SERVICEDESC$"  -r "Nagios Alert <>" $CONTACTEMAIL$

So, what Nagios basically does is pipe the formatted message body to the /usr/bin/mail command, which has a bunch of command line options to specify the Subject, the Reply-to, etc. In particular, I'm explicitly setting the From: with the "-r" option because I want such notifications to come from our general "systems" mailing list.

You may have set up your own notify-by-email command. Look at the man page for your system mail command to see what options you can use to specify the usual mail headers.

share|improve this answer

You have to look for the command definition that is used to send out notifications. In my case all my notification commands are in nagios/etc/misccommands.cfg. Somewhere in that definition is the command that is run to send out notification e-mails. You have to fix that. I am a Solaris guy and not familiar with the sendEmail command but the man page should give you clues. Maybe compare the host notification definition with the service notification definition and look for differences.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.