Same Host Dependencies With Servicegroups
Posted: Sun Jul 13, 2014 10:34 am
My turn to ask a question. We had a minor meltdown with one of our virtual hosts still being reachable via ping, but having the out-of-memory reaper start blowing away services. So we had a lot of alerts that could have been avoided if we'd just seen the "out of memory" errors in all the weeds. The host (and others like it) are checked via NRPE. They belong to a hostgroup called "private" and the services that rely on NRPE being functional belong to a servicegroup called "NRPE". There is also a service check that simply checks to see if NRPE is responding called "NRPE-service". This is all on Nagios Core 4.0.7.
Enter Time-Saving Tricks For Object Definitions and the section on "Same Host Dependencies With Servicegroups" (last one in the section).
I believe we should be able to specify our dependency (to make NRPE-dependent checks depend on the NRPE service being up and running) as:
to make each service in the NRPE servicegroup dependent on the NRPE-service on that host.
This sort of works. What we get is each service in the NRPE servicegroup on each host being dependent upon the NRPE-service but only on the last host listed in the hosts config file that has services that match the service group. This was confirmed by moving the order around in the config file. So we added hostgroup_name to the list:
And it's the same thing. We tried using combinations of hostgroup_name, host_name, dependent_hostgroup_name and dependent_host_name, but many combinations were outright rejected by the parser, while the closest we could get to what we want is the two excerpts above - straight out of the documentation example.
I'd really like to avoid having to list all the service_descriptions (which works, if we use the hostgroup_name directive), and since this is a direct implementation of what's listed in the documentation, I believe it's a bug in the parser. But if it's not, and we're doing something wrong, please let me know.
Enter Time-Saving Tricks For Object Definitions and the section on "Same Host Dependencies With Servicegroups" (last one in the section).
I believe we should be able to specify our dependency (to make NRPE-dependent checks depend on the NRPE service being up and running) as:
Code: Select all
define servicedependency{
service_description NRPE:service
dependent_servicegroup_name NRPE
<remainder of dependency code>
}
This sort of works. What we get is each service in the NRPE servicegroup on each host being dependent upon the NRPE-service but only on the last host listed in the hosts config file that has services that match the service group. This was confirmed by moving the order around in the config file. So we added hostgroup_name to the list:
Code: Select all
define servicedependency{
hostgroup_name private
service_description NRPE:service
dependent_servicegroup_name NRPE
<remainder>
}
I'd really like to avoid having to list all the service_descriptions (which works, if we use the hostgroup_name directive), and since this is a direct implementation of what's listed in the documentation, I believe it's a bug in the parser. But if it's not, and we're doing something wrong, please let me know.
Code: Select all
NagiosĀ® Coreā¢
Version 4.0.7