Changing email to when starting downtime

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.
sreinhardt
-fno-stack-protector
Posts: 4366
Joined: Mon Nov 19, 2012 12:10 pm

Re: Changing email to when starting downtime

Post by sreinhardt »

There is a key difference in the Use definition. This is inheriting those settings from a template, in the case of nagiosadmin generic-contact. These settings should already be applied, however if you do choose to define them for nagiosadmin it will overwrite anything for that same setting applied via the template.
Nagios-Plugins maintainer exclusively, unless you have other C language bugs with open-source nagios projects, then I am happy to help! Please pm or use other communication to alert me to issues as I no longer track the forum.
vivithemage
Posts: 102
Joined: Tue May 21, 2013 2:52 pm

Re: Changing email to when starting downtime

Post by vivithemage »

Ah, and where is the template? Is that:

Code: Select all

/usr/local/nagios/etc/objects/templates.cfg
which is default:

Code: Select all

define contact{
        name                            generic-contact         ; The name of this contact template
        service_notification_period     24x7                    ; service notifications can be sent anytime
        host_notification_period        24x7                    ; host notifications can be sent anytime
        service_notification_options    w,u,c,r,f,s             ; send notifications for all service states, flapping events, and scheduled downtime events
        host_notification_options       d,u,r,f,s               ; send notifications for all host states, flapping events, and scheduled downtime events
        service_notification_commands   notify-service-by-email ; send service notifications via email
        host_notification_commands      notify-host-by-email    ; send host notifications via email
        register                        0                       ; DONT REGISTER THIS DEFINITION - ITS NOT A REAL CONTACT, JUST A TEMPLATE!
        }
so I could just add this to my contact file:

Code: Select all

/usr/local/nagios/etc/objects/contacts.cfg

Code: Select all

        service_notification_options    w,u,c,r,f            ; send notifications for all service states, flapping events, and scheduled downtime events
        host_notification_options       d,u,r,f               ; send notifications for all host states, flapping events, and scheduled downtime events
and then create my new contact with only:

Code: Select all

  
define contact {
                contact_name                          downtimealerts
                alias                                 downtimealerts
                service_notification_options    s            ; send notifications for all service states, flapping events, and scheduled downtime events
                host_notification_options       s               ; send notifications for all host states, flapping events, and scheduled downtime events
                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
}

      

Where are the services/monitored sites configuration I should add these to? Assuming this setup is accurate in my ocntacts.cfg?
slansing
Posts: 7698
Joined: Mon Apr 23, 2012 4:28 pm
Location: Travelling through time and space...

Re: Changing email to when starting downtime

Post by slansing »

Lets just clear up one point, are you running Nagios Core or Nagios XI? Your other thread refers to NDO2DB and MySql. Just want to make sure you are not trying to edit the flat .cfg files if you are using XI, rather than the interface.
vivithemage
Posts: 102
Joined: Tue May 21, 2013 2:52 pm

Re: Changing email to when starting downtime

Post by vivithemage »

It loos like we are running core...

Nagios® Core™ 3.4.1 I found the ndo2db service, it was stopped, and installed in a non standard folder, and thus had no /etc/init.d/ startup script.
slansing
Posts: 7698
Joined: Mon Apr 23, 2012 4:28 pm
Location: Travelling through time and space...

Re: Changing email to when starting downtime

Post by slansing »

You could add:

Code: Select all

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


To contacts in your contacts.cfg file, it will do as sreinhardt pointed out above. You do not need to use the template's options if you do not choose. Contact's will use their notification options, but you should set the same options for your services/hosts in their .cfg files. These files are typically in /usr/local/nagios/etc/hosts and /services.
vivithemage
Posts: 102
Joined: Tue May 21, 2013 2:52 pm

Re: Changing email to when starting downtime

Post by vivithemage »

slansing wrote:You could add:

Code: Select all

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


To contacts in your contacts.cfg file, it will do as sreinhardt pointed out above. You do not need to use the template's options if you do not choose. Contact's will use their notification options, but you should set the same options for your services/hosts in their .cfg files. These files are typically in /usr/local/nagios/etc/hosts and /services.
Yeah, that is what I posted...just add those lines to my nagios contact currently. Then add the one I listed above, and add it to the cfg files for the services/hosts and it should be good.
slansing
Posts: 7698
Joined: Mon Apr 23, 2012 4:28 pm
Location: Travelling through time and space...

Re: Changing email to when starting downtime

Post by slansing »

Yes...you were asking if you could do that.. let us know if you need further help.
Locked