For some reason it’s not as apparent to change the outgoing Nagios e-mail address as you would think. It typically sends from nagios@your.host.name, which is fine for us nerds, but doesn’t look as nice when you’re providing monitoring services for a client or a co-worker.

Please note that this article assumes you’re using sendmail!

In order to change the sending address that Nagios uses, you will actually have to tell sendmail to “re-write” the default address. This is done using sendmail’s genericstable feature. Step 1 is to enable genericstable by adding the following lines to /etc/mail/sendmail.mc. Make sure that these are above the MAILER(…)dnl lines at the bottom:

FEATURE(`genericstable’)dnl
GENERICS_DOMAIN(`your.host.name’)dnl

After adding those, close and save the file and run the following command to apply your configuration changes:

m4 /etc/mail/sendmail.mc > /etc/mail/sendmail.cf

Now that we’ve enabled the genericstable feature, we can add the re-write. You will want to edit/create /etc/mail/genericstable and add the following line (customizing for your desired address of course):

nagios mynewaddress@my.domain

Close and save the file. Now we want to build a genericstable database that sendmail can understand:

makemap hash /etc/mail/genericstable < /etc/mail/genericstable

And finally, for good measure, restart sendmail:

/etc/init.d/sendmail restart

Now Nagios should be sending out e-mails using a user-friendly address!

Sorry, comments are closed.