Page 1 of 2

Changing email to when starting downtime

Posted: Tue May 21, 2013 2:54 pm
by vivithemage
Is it possible to change the email addrss nagios emails when starting downtime, and recovering from downtime?

Re: Changing email to when starting downtime

Posted: Tue May 21, 2013 3:55 pm
by sreinhardt
That is not currently a feature of nagios core. You could certainly request it at tracker.nagios.org!

Re: Changing email to when starting downtime

Posted: Tue May 21, 2013 3:56 pm
by slansing
You could also create another contact that would receive emails when downtime occurs for a host/service, and then disable downtime alerts for your other contacts.

Re: Changing email to when starting downtime

Posted: Tue May 21, 2013 4:04 pm
by vivithemage
slansing wrote:You could also create another contact that would receive emails when downtime occurs for a host/service, and then disable downtime alerts for your other contacts.
We are hoping to have alerts go to one email, and downtime go to another.

Re: Changing email to when starting downtime

Posted: Wed May 22, 2013 11:18 am
by slansing
Sure, then you could edit the contacts configuration file and remove the "s" from notification options, this is the scheduled downtime flag. Then, you could create a new contact, and name them something along the lines of "Downtime Contact," and with them, only add the "s" options, then make sure both contacts are added to the services/hosts that you expect this behavior on. This way, both contact addresses will be notified for their respective notification options.

Re: Changing email to when starting downtime

Posted: Thu May 23, 2013 11:16 am
by vivithemage
slansing wrote:Sure, then you could edit the contacts configuration file and remove the "s" from notification options, this is the scheduled downtime flag. Then, you could create a new contact, and name them something along the lines of "Downtime Contact," and with them, only add the "s" options, then make sure both contacts are added to the services/hosts that you expect this behavior on. This way, both contact addresses will be notified for their respective notification options.
That sounds REALLY simple! Where is the contacts configuration file? I did not set this instance of nagios up, so I am unsure.

Re: Changing email to when starting downtime

Posted: Thu May 23, 2013 11:26 am
by slansing
You can find all of the main configuration files in the following directory:

/usr/local/nagios/etc

In this case look for contacts.cfg

It should be quite simple! Simply add/change your contact(s) information there, then assign their contact name to hosts/services in their respective files, of course after these changes are all made verify that the config files are formatted correctly with:

http://nagios.sourceforge.net/docs/3_0/ ... onfig.html

:) Let us know if you have questions.

Re: Changing email to when starting downtime

Posted: Tue May 28, 2013 3:00 pm
by vivithemage
This is my current contact.cfg:


define contact{
contact_name nagiosadmin ; Short name of user
use generic-contact ; Inherit default values from generic-contact template (defined above)
alias Nagios Admin ; Full name of user

email [email protected] ; <<***** CHANGE THIS TO YOUR EMAIL ADDRESS ******
}
define contact {
contact_name boss
alias Da Boss
host_notification_options d,u,r,f
service_notification_options w,u,c,r,f
email [email protected]
host_notification_period none
service_notification_period none
host_notification_commands notify-host-by-email
service_notification_commands notify-service-by-email
}


The nagiosadmin is the one where we receive emails as a contact. I don't see any host_notifcation_options, should I just add the line, similar to our boss contact? Is there a definition to all of the notification options?

Also, where would I add them to the services/hosts cfg files exactly?

Re: Changing email to when starting downtime

Posted: Tue May 28, 2013 3:27 pm
by slansing
I don't see any host_notifcation_options, should I just add the line, similar to our boss contact?
It looks like it is in the definition you linked, as it should be, each contact can control what types of state changes they are notified for on a Host and/or Service level.

To assign a contact to a host/service by adding the "contacts" line:

http://nagios.sourceforge.net/docs/3_0/ ... ml#service

Like so:

Code: Select all

contacts        nagiosadmin,boss

Re: Changing email to when starting downtime

Posted: Tue May 28, 2013 3:31 pm
by vivithemage
nagiosadmin does not have:

host_notification_options d,u,r,f
service_notification_options w,u,c,r,f

like da boss does though ... or am I missing something?