Page 1 of 1

Mail from nagios@host vs [email protected]

Posted: Fri Nov 26, 2010 11:46 am
by nosebreaker
So I have my nagios installs working fine and dandy, however I cannot send to users on remote servers. The reason is because when nagios sends to a remote user, the from field is "nagios@host" instead of a FQDN. I looked at commands.cfg and see how it calls mail, but there is no flag to pass to mail to set the from field. It looks like in prior versions there was a way to set it by overwriting a header (with "-a "From: [email protected]"), but the version I have doesn't allow that (I am using CentOS 5.5).

So when nagios sends to users on the same server, they come through as [email protected] as they should, but when it tries to send to remote servers it just comes from nagios@host and is rejected by the remote server! Any ideas on how to set the from field or make it think the host is the FQDN and not just the hostname?

Re: Mail from nagios@host vs [email protected]

Posted: Sun Nov 28, 2010 3:59 pm
by nosebreaker
So I installed nail, which is a better version of mail. So I call /usr/bin/nail now instead, and it STILL has the same problem! I force the from field with "-f [email protected]" but it IGNORES it when sending to a remote host! So it still complains about sending as "nagios@host" on the destination server!

Re: Mail from nagios@host vs [email protected]

Posted: Mon Nov 29, 2010 10:52 am
by nosebreaker
Ah-ha! So the solution for this problem was setting the hostname properly. If I ran "hostname -f" it should have returned the FQDN, but it returned just the hostname. In my case I set the hostname with "hostname -v server.domain.com" and restarted nagios and it worked!