Mail from nagios@host vs nagios@host.domain.com

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
nosebreaker
Posts: 4
Joined: Fri Nov 26, 2010 11:42 am

Mail from nagios@host vs nagios@host.domain.com

Post 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: whoever@domain.com"), 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 nagios@host.domain.com 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?
nosebreaker
Posts: 4
Joined: Fri Nov 26, 2010 11:42 am

Re: Mail from nagios@host vs nagios@host.domain.com

Post 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 from@domain.com" but it IGNORES it when sending to a remote host! So it still complains about sending as "nagios@host" on the destination server!
nosebreaker
Posts: 4
Joined: Fri Nov 26, 2010 11:42 am

Re: Mail from nagios@host vs nagios@host.domain.com

Post 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!
Locked