Nagios sends e-mail from localhost.localdomain

If you have a default linux/nagios installation, nagios will send e-mail from nagios@localhost.localdomein.
Even if you change the contact in your nagios configuration, it will keep sending e-mails from localhost.localdomain.

Why?

Nagios uses the default sendmail configuration to send Alerts.

How to resolve?

Change the sendmial configuration:

# yum install sendmail-cf
# vi /etc/mail/sendmail.mc

Change the following:

dnl MASQUERADE_AS(`mydomain.com')dnl

to

MASQUERADE_AS(`yourdomain.com')dnl

Then run

make -C /etc/mail; service sendmail reload