Change the default email domain for SendMail / Ctrladdr / Nagios From Email

Hi,

I was searching to send Nagios alert email from a CentOS box. Normally when you setup your sendmail using a smart relay. The default email it’s always :
username@linux_hostname_fqdn. or nagios@nagiossrv.domain.local

to replace the @nagiossrv.domain.local. The only way I figure it out.

I modified the *** modify the hostname to have your domain name
/etc/sysconfig/network
HOSTNAME=nagiossrv.cyberblogue.com

change the cyberblogue.com for your domain name.

Now I modified the Host File.
/etc/hosts
127.0.0.1 cyberblogue.com nagiossrv.cyberblogue.com localhost …..
::1 cyberblogue.com nagiossrv.cyberblogue.com localhost …..

I added my domain first, after my server name.

Restart the server

Test your Nagios notification, this should be now from : nagios@cyberblogue.com (or in your case nagios@yourdomain.com

This should work.

Leave a Reply