Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

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.

share|improve this question

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.

share|improve this answer
    
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 Sep 11 '13 at 20:47

Your Answer

 
discard

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.