I'm working with a CentOS server that has Nagios running and sending notification emails. The emails are still going to the old email system which was kept up to ensure all emails were being routed to the correct location. I didn't set the system up, but it appears that this machine was able to relay to the smtp server to send mail? It still sends it through to the old system. I have the hostname for the new SMTP server but I'm not sure where I need to input this data.

1 Answer 1


Nagios actually uses external commands to send email—it doesn't send them directly. For example, in our config here, /etc/nagios3/commands.cfg contains (in part):

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 "** $NOTIFICATIONTYPE$ Host Alert: $HOSTNAME$ is $HOSTSTATE$ **" $CONTACTEMAIL$

if you scroll to the right, you'll see that it's sending via /usr/bin/mail. mail generally uses the system MTA (Exim in my case, but probably not yours).

If yours is also going through the system MTA, you'll probably find the Email chapter of the Deployment Guide useful, in particular its two MTA sections.

  • I'm sorry if I wasn't clear, but the commands were already setup before me and they use the "/usr/sbin/mail" command to send emails. I updated the sendmail.mc configuration file to point the "Smart Host" at my smtp server. Everything seems to be working for now.
    – Trim
    Commented Sep 11, 2013 at 20:47

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .