Nagios 3 and hostgroup inheritance
As I wrote some time ago, I was trying to utilize Nagios 3.x’s neat feature of “nested” hostgroups. Well, as it turned out I thought it worked differently; basically like this:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | define hostgroup {
hostgroup_name a-parent-hostgroup
alias Our toplevel parent hostgroup
}
define service {
use generic-service
check_command check_dummy!0!
service_description SSH
hostgroup_name a-parent-hostgroup
}
define hostgroup {
hostgroup_name a-child-hostgroup
hostgroup_members a-parent-hostgroup
alias Our child hostgroup
}
define service {
use generic-service
check_command check_dummy!0!
service_description LOAD
hostgroup_name a-child-hostgroup
} |
As you can cleary see on line 14, I thought you define the relation between two hostgroups in the child hostgroup. The problem with it was basically (as I said in the earlier posts), that all the services defined for the child hostgroups are handed on upwards to the parent hostgroup(s).
But after talking to Tobi, I quickly found out, that the relation is in fact defined within the parent hostgroup. So if you simply put hostgroup_members within the parent hostgroup and define all child hostgroups which should inherit from the parent one, you should be just fine.
[...] I was playing with the hostgroup inheritance earlier. One problem with that is, if you define a duplicate service Nagios is really unpredictable [...]