email notification not going out

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
Locked
happy
Posts: 20
Joined: Wed Nov 28, 2012 4:37 pm

email notification not going out

Post by happy »

Hello

I have recently installed nagios and have configured hosts to be monitored. Everything is now working except email notifications are not going through. I have limited experience with Linux and this is my first attempt with Nagios as well.

I am on CentOS 6.3 and am trying to get Postfix to send email using my exchange server for smtp.

I have made configuration changes to /etc/postfix/main.cf that look like this:

mail_owner = postfix
myhostname = mail.domainname.com
mydomain = domainname.com
myorigin = $myhostname
inet_interfaces = all
mydestination = localhost, localhost.domainname.com
mynetworks = 10.x.0.0/16, 127.0.0.0/8
home_mailbox = Maildir/

- I can use mail command on the server to send email to local accounts (ie, root, nagios) ... no problem
- I have verified that my my CentOS box is able to telnet to my exchange on port 25 ... no problem

However, Nagios is not able to send out email. So I tried it with mail command to send email to my exchange email address. This is what shows in my maillog file

Nov 28 23:13:39 CentOSServerName postfix/smtp[10188]: connect to domainname.com[10.x.x.x]:25: Connection timed out (my dns/ad server ip)
Nov 28 23:13:39 CentOSServerName postfix/smtp[10189]: connect to domainname.com[10.x.x.x]:25: Connection timed out (my dns/ad server ip)
Nov 28 23:13:39 CentOSServerName postfix/smtp[10189]: connect to domainname.com[10.x.x.x]:25: Connection refused (my second dns/ad server ip)
Nov 28 23:13:39 CentOSServerName postfix/smtp[10189]: connect to domainname.com[10.x.x.x]:25: Connection refused (my third dns/ad server ip)
Nov 28 23:13:39 CentOSServerName postfix/smtp[10188]: B4C1E809BB: to=<myemail@domainname.com>, relay=none, delay=23723, delays=23693/0.02/30/0, dsn=4.4.1, status=deferred (connect to domainname.com[10.x.x.x]:25: Connection timed out)

From the logs it appears that Postfix is trying to send email using my dns/ad server instead of mail server that I mentioned in the main.cf file! How can I force it to use correct server to send out emails? I must have overlooked something.

I would really appreciate if someone can identify the disconnect here.

Many Thanks!
happy
Posts: 20
Joined: Wed Nov 28, 2012 4:37 pm

Re: email notification not going out

Post by happy »

Hi

Just to update that the issue is resolved. I needed relayhost entry and had to correct my hostname!
agriffin
Posts: 876
Joined: Mon May 09, 2011 9:36 am

Re: email notification not going out

Post by agriffin »

Glad you got it resolved!
Locked