Page 1 of 1

Need additional contacts to be notified for service notif

Posted: Wed Aug 19, 2015 1:58 am
by sushant4tech
Hi All,

I have set up few hosts and services on Nagios Core model. For notifications sent to the contacts in case of warning and critical states, the hosts and services refer to the generic config files. I have created a contact group "admins" which has members that needs to know about states of all hosts and services. Other than the contacts defined in admins group there are some contacts which specificly needs to know about a particular host or service (the hosts or services of their interest).

Since all the hosts and services i defined use generic host/service template, i am having hard time figuring out how to notify additional contacts (specific contacts for specific host/services). Because not all contacts are interested in knowing the state of all hosts and services except the admins. if i add any member in the generic template then by definition all contacts will get notified.

If i add members in definition of host or service, will the notifications sent to admins(defined in generic definition) + selected contact (defined in the host/service definition)?

Re: Need additional contacts to be notified for service noti

Posted: Wed Aug 19, 2015 12:23 pm
by tgriep
Yes, if you add the specific contacts to the host / service checks they will be notified as well as the contact groups through the template assigned to those checks.

Re: Need additional contacts to be notified for service noti

Posted: Wed Aug 19, 2015 7:58 pm
by Box293
sushant4tech wrote:If i add members in definition of host or service, will the notifications sent to admins(defined in generic definition) + selected contact (defined in the host/service definition)?
Make sure all the contact/contactgroup objects are defined with a + sign to ensure they are additive.

https://assets.nagios.com/downloads/nag ... tance.html
Read the bit Additive Inheritance of String Values.

Re: Need additional contacts to be notified for service noti

Posted: Tue Sep 15, 2015 6:10 am
by sushant4tech
Hello tgriep,

Thank you for the tip. I am replying late but wanted closure on this post.
Make sure all the contact/contactgroup objects are defined with a + sign to ensure they are additive.
This works. I added contact group as in the code below in the definition of host/services and now i can have a custom contact for any notification for specific host or service.

Code: Select all

define service{
                use                     generic-service
                host_name               gts-db
                service_description     Mysql Server
                check_command           check_mysql_cmdlinecred!wtraffline!traffline!gts
                contact_groups          +db_notif
}
I can use 'contact group name' defined in contacts.cfg. in front of the '+' in code above and this specific group gets the notification.

Thanks, this is sorted.

Re: Need additional contacts to be notified for service noti

Posted: Tue Sep 15, 2015 9:06 am
by hsmith
Glad to hear that it is working for you now. I'll go ahead and mark this one resolved and close it.