mailx must be installed and configured. (see prev post)
The commands also have to be amended:
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.
sudo /etc/init.d/nagios restart
Contacts and groups are configured in contact.cfg. By default email are sent to admin. Default member is nagiosadmin. Nagios admin email address (your's) are set in the same file.
2)States and flapping
When a problem appear it first goes to "soft state" and after 3 checks (3/3) it change to "hard state" and the notification is sent.
If the hard state change on and off too often the service is determined to be "flapping". To change the flapping thresholds add these lines to the service definition:
When the service is flapping no notifications is sent until it stops flapping.
If we want to have a notification when flapping start add this line to service definition:
(f for flapping)