The mail program is not included in nagios. You need a command line mail client AND you have to make sure that you can relay emails from the nagios server to your email account. If your email account is not on the same network as the nagios server and you dont understand this stuff chances are that relay is blocked. Most networks are blocking mail servers and most mail servers deny anonymous relay.
In my stetup the company mail server is accepting relay for internal addresses but I cannot send a notification to e.g. hotmail.
So you need to do three things
- Make sure you have a way to relay the email from nagios => you email account. The best way is to have access to a mail server that accepts relay from the nagios server.
- Make sure you can send an email from command line => your email account
- Make sure that the notification command in nagios match the command and path use used in 2)
For ubuntu this works:
[code]If you want to receive email notifications for Nagios alerts, you need to install the mailx (Postfix) package.
sudo apt-get install mailx
Select sattellite and enter relay server (in this case the exchange server)
test in terminal
(NB: company server only accept relay for local addresses)
Enter to end subject
CTRL-D to end body
Edit the Nagios email notification commands found in /usr/local/nagios/etc/objects/commands.cfg and change any ‘/bin/mail’ references to ‘/usr/bin/mail’. Once you do that you’ll need to restart Nagios to make the configuration changes live.[/code]