Nagios Email Configuration From Scratch

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
Darth_Panda
Posts: 27
Joined: Sun Jun 28, 2015 7:01 am

Nagios Email Configuration From Scratch

Post by Darth_Panda »

Would anyone have a good step by step tutorial for configuring email alerts with Debian 8 and Nagios Core 4.0.8. I want to take my time and get it right.

Thanks :)
jdalrymple
Skynet Drone
Posts: 2620
Joined: Wed Feb 11, 2015 1:56 pm

Re: Nagios Email Configuration From Scratch

Post by jdalrymple »

Is Postfix or some other local MTA enabled on Debian by default? If so the steps to configure it from scratch are as follows:

1) Create a contact with a valid E-mail address.

If there is no MTA - get one and make it work.
Darth_Panda
Posts: 27
Joined: Sun Jun 28, 2015 7:01 am

Re: Nagios Email Configuration From Scratch

Post by Darth_Panda »

Thanks :)
jdalrymple
Skynet Drone
Posts: 2620
Joined: Wed Feb 11, 2015 1:56 pm

Re: Nagios Email Configuration From Scratch

Post by jdalrymple »

To be more elaborate, understand that by default Core simply pipes some sensible string output into the `mail` command defined on your system. Who it's mailed to is defined in your contact definition and passed in as an argument to `mail`.

If you have a local MTA to handle that mail command and also if your system is allowed to relay mail to whatever the destination may be, you should be in good shape.

OK to lock this one?
Darth_Panda
Posts: 27
Joined: Sun Jun 28, 2015 7:01 am

Re: Nagios Email Configuration From Scratch

Post by Darth_Panda »

jdalrymple wrote:To be more elaborate, understand that by default Core simply pipes some sensible string output into the `mail` command defined on your system. Who it's mailed to is defined in your contact definition and passed in as an argument to `mail`.

If you have a local MTA to handle that mail command and also if your system is allowed to relay mail to whatever the destination may be, you should be in good shape.

OK to lock this one?
I have configured Exim4. I have successfully tested Exim by using the 'mail' command and I can see the test email in the log. Unfortunately I can't see any of the Nagios emails. I can the alerts history and quite a few emails should have come through by now. I am wondering if I should be looking at the commands.cfg file to see if it is configured correctly to talk to Exim?
jdalrymple
Skynet Drone
Posts: 2620
Joined: Wed Feb 11, 2015 1:56 pm

Re: Nagios Email Configuration From Scratch

Post by jdalrymple »

It seriously should be doing something like `printf "a bunch of stuff | mail -s "from nagios" youraddress@whatever.com`

If `mail` works from the command line it should work from Nagios.

1) You're right, double check your commands.cfg. Note that the command used for notifications is in the contact definition and there are 2 of them, one for hosts and a separate one for services.

2) You say alerts are being raised, that doesn't necessarily imply a notification. Have you verified notifications from the Nagios UI? Under reports on the left-hand side (incidentally right underneath alerts).
Darth_Panda
Posts: 27
Joined: Sun Jun 28, 2015 7:01 am

Re: Nagios Email Configuration From Scratch

Post by Darth_Panda »

Thanks for your help. I noticed that commands.cfg was using the command 'sendmail', not sure why. When I changed it back to 'mail' it worked. Emails now coming through, thanks :)
Locked