Recieving mail outside the host server


I would like to have email alerts forwarded to me from my server. Mainly when it see a site go off line. Can you please explain what changes need to be made to the commands.cfg? I am using UBUNTU Gusty. Thank you.


Forwarded? I don’t get what you want to do. Is there any mail account on your server which receives notifications and you would like mails from that account to be forwarded? Or you want an extra message to be sent to you also.
If the second option is correct, then no modifications should be made to commands.cfg, but you will have to add your email address as contact in your contact definitions and add that contact to a contactgroup. … ml#contact


I would like my server to send an email to any specified email address, with a notification when a site goes off-line or is not sending SNMP etc…Right now I have to log into Nagios and keep an eye on it. I would like to be able to be more proactive and recieve email alerts/notifications from my server.


do you have a mail program installed on your server?

if you execute on the command line:

echo Testing 123 | mail -s test

replacing your email address, do you get the email?

Look in your commands.cfg file. There is a default command called notify-host-by-email and one called notify-service-by-email. Make sure they are there. If not, look in the docs for an example of it.

In your contact definitions, make sure for your name that you have yourself as a contact with notifications enabled and pointed to the correct commands. Here is an example

define contact{
name admins
contact_name me
#contactgroups Server Admins
host_notifications_enabled 1
service_notifications_enabled 1
host_notification_commands notify-host-by-email
service_notification_commands notify-service-by-email
can_submit_commands 1
host_notification_period 24x7
service_notification_period 24x7
host_notification_options d,r,f,s
service_notification_options c,r,f

Then make sure that your services and hosts (or a parent template) have


contacts me
notifications_enabled 1
notification_options d,r,f,s


contacts me
notifications_enabled 1
notification_options c,r,w

That will email you anytime a hsot goes down, recovers, starts/stops flapping and enters scheduled downtime and whenever a service is in critical, warning or recovers.

Study the docs a little bit and you will see with templeting and inheritance, there are a billion and a half ways of applying this, but that is the basics of it. Have a contact with an email address and contact options, have a host or service with the contact as a contact with notification criteria set.


Thank you Thank you Thank you. I figured it was something like that. I have not tried it yet, but will let you know as soon as I do. I have edited the contacts.cfg and have installed mailx on the server. I did that prior to posting this thread. Again thanks…