[SOLVED] Problem:Different Inheritance for Hosts vs Services

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.
Locked
kjhosein
Posts: 7
Joined: Wed Jul 03, 2013 7:18 am

[SOLVED] Problem:Different Inheritance for Hosts vs Services

Post by kjhosein »

I have a weird problem with Nagios inheritance.

Here's my setup:
  • * Hosts are all in Hostgroups
    * Contacts are all in Contactgroups
    * Services are assigned to Hostgroups (not to Hosts)
    * Contactgroups are assigned to Hosts
    * Contacts and contactgroups are *not* assigned to services. I'm depending on implied inheritance per http://nagios.sourceforge.net/docs/3_0/ ... nheritance for the service to inherit its contactgroup(s) from the host.
Here is an example of one of my contactgroups. The ones in the square brackets [] are the groups, and the others are just contacts:

[alerts_for_production]
|--ernie_for_production_email
|--bert_for_production_email
|--[backup_alert_group]
. . . |--grover_for_backup_email (grover is a contact member of the backup_alert_group)


But here's what's happening (from observing objects.cache):

The hosts see the contactgroup as alerts_for_production, but the associated services see the contactgroup as backup_alert_group. I would have thought that both hosts and associated services would see both alerts_for_production and backup_alert_group as the contactgroups.

As a test, I decided to add in a single contact to the host (for example, ernie_for_production_email). That worked as expected - both host and service were assigned that contact.

Is this expected behavior or is my understanding incorrect?
I'd appreciate any insight or thoughts. Thanks!
Last edited by kjhosein on Wed Nov 13, 2013 9:05 am, edited 3 times in total.
User avatar
lmiltchev
Bugs find me
Posts: 13589
Joined: Mon May 23, 2011 12:15 pm

Re: Problem: Different Inheritance for Hosts vs Services

Post by lmiltchev »

The following table lists the object variables that will be implicitly inherited from related objects if you don't explicitly specify their value in your object definition or inherit them from a template.
Can you show the service definition? Have you assigned any contacts/contactgroups to this service? Are you using a template?
Be sure to check out our Knowledgebase for helpful articles and solutions!
kjhosein
Posts: 7
Joined: Wed Jul 03, 2013 7:18 am

Re: Problem: Different Inheritance for Hosts vs Services

Post by kjhosein »

Good call @lmiltchev! I had thought that my service template didn't have any contact info in it, but I was mistaken. Once I removed the contact group from the service template, the config expanded out as I expected.

Thanks!
Locked