LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Server (http://www.linuxquestions.org/questions/linux-server-73/)
-   -   Nagios email notifications don't get sent, need to configure mailx, how? (http://www.linuxquestions.org/questions/linux-server-73/nagios-email-notifications-dont-get-sent-need-to-configure-mailx-how-783893/)

mitchell7man 01-21-2010 08:01 PM

Nagios email notifications don't get sent, need to configure mailx, how?
 
1 Attachment(s)
Okay so I've set up nagios on a CentOS 5 box and am having trouble getting it to send out email, nagios is monitoring several systems/services in the building. What I need to do is to get nagios to send notifications using a mail server rather than trying to send from itself, if that makes sense. I've googled all over the place about how to do this, but I couldn't find clear steps or guidelines everywhere and I haven't gotten the emails to get out of the box. So I guess my question is what are the steps I need to follow to get nagios email notifications sending through an external mail server?

Thanks for any help you might be able to provide.

-Mitchell Jones

an image of my .mailrc is attached....

EricTRA 01-22-2010 12:12 AM

Hello,

Do you have any MTA (Mail Transfer Agent) like for example Postfix set up? Also can you indicate if you are sending mail to your own mail server or to something like a GMail/Hotmail/other account? The way I have it set up is using Postfix to relay all mail to our GMail for Enterprises and it works like a charm.

Kind regards,

Eric

mitchell7man 01-26-2010 01:44 PM

I believe I have postfix installed, but don't know exactly how to configure it to interact with nagios and the mail server. I'm trying to send the email through my companies mail server.
Thanks,
-MJ

EricTRA 01-26-2010 01:53 PM

Hi,

If you have Postfix installed then all you have to do is configure it to relay the mail to your company's mailserver. Is the Nagios server on the same network as the mailserver? Configuration of Postfix for this is done in the main.cf configuration file. I'm not familiar with CentOS but I think it should be in /etc/postfix directory.

In order to relay your mails from Nagios to your mailserver in your main.cf file you should have something like this:
Code:

myhostname = yournagios.domainname.com
alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases
myorigin = /etc/mailname
mydestination = yourmailserver.domainname.com, localhost, yournagios.domainname.com
relayhost =
mynetworks = 127.0.0.0/8
mailbox_command = procmail -a "$EXTENSION"
mailbox_size_limit = 0
recipient_delimiter = +
inet_interfaces = localhost
relay_domains = yournagios.domainname.com

That should get you started sending mail to your mailserver. Of course you'll have to tell your mailserver to allow relaying from your nagios server in order to work.

Kind regards,

Eric


All times are GMT -5. The time now is 08:05 AM.