Page 1 of 1
Service Dependencies - Host Groups
Posted: Thu Feb 20, 2020 3:27 pm
by jenglish
Hello,
I'm trying to achieve a goal of less noise when we're patching our log servers (which require a reboot).
My elements:
logserver-NY
logserver-PA
logservers NY and PA are both in a hostgroup.
Code: Select all
define servicedependency {
hostgroup_name nm-logservers
service_description nrpe
dependent_hostgroup_name All-Linux,All-Windows,!eqip-idm-servers,!nm-idm-servers
dependent_service_description Check logs being written to central log server
execution_failure_criteria c,u,w
notification_failure_criteria c,u,w ; this should be correct - basically NOT alert when service is
in "critical" state
}
My question is, in the statement above, does nrpe service have to fail on ALL hosts in the nm-logservers hostgroup for this to silence the "check logs" service? Much like a bash condition - is it an OR or AND?
The ideal logic for me is:
if logserver NY nrpe or logserver PA nrpe is down, then don't alert the "check logs" service.
Re: Service Dependencies - Host Groups
Posted: Thu Feb 20, 2020 3:41 pm
by scottwilkerson
It would be the equivalent of an OR, because all of the dependencies need to pass (or be OK) for execution or notifications to continue
From the docs:
https://assets.nagios.com/downloads/nag ... ncies.html
If all of the execution dependency tests for the service passed, Nagios Core will execute the check of the service as it normally would. If even just one of the execution dependencies for a service fails, Nagios Core will temporarily prevent the execution of checks for that (dependent) service. At some point in the future the execution dependency tests for the service may all pass. If this happens, Nagios Core will start checking the service again as it normally would. More information on the check scheduling logic can be found here.
Re: Service Dependencies - Host Groups
Posted: Fri Feb 21, 2020 11:58 am
by jenglish
ah! Thanks
@scottwilkerson. I'll give that a try and see if it works as expected.
Re: Service Dependencies - Host Groups
Posted: Fri Feb 21, 2020 12:18 pm
by scottwilkerson
jenglish wrote:ah! Thanks
@scottwilkerson. I'll give that a try and see if it works as expected.
Sounds good
Re: Service Dependencies - Host Groups
Posted: Fri Mar 27, 2020 12:51 pm
by jenglish
@scottwilkerson I was able to get this to work, but one more question about service dependencies.
Will globbing work? For example, I have 2 services that I need to shut up whenever I reboot a server. I commented below with the differences with "HERE."
Code: Select all
define servicedependency {
host_name boy-sanford
service_description nrpe
dependent_hostgroup_name eqip-boyers-training ; HERE
dependent_service_description Check logs being written to central log server - Boyers TRAINING ; HERE
execution_failure_criteria c,u,w
notification_failure_criteria c,u,w
}
define servicedependency {
host_name boy-sanford
service_description nrpe
dependent_hostgroup_name eqip-boyers-av ;HERE
dependent_service_description Check logs being written to central log server - Boyers AV ; HERE
execution_failure_criteria c,u,w
notification_failure_criteria c,u,w
I'd like it if I could consolidate it to this:
Code: Select all
define servicedependency {
host_name boy-sanford
service_description nrpe
dependent_hostgroup_name eqip-boyers*
dependent_service_description Check logs being written to central log server - Boyers*
execution_failure_criteria c,u,w
notification_failure_criteria c,u,w
}
Thanks!
Re: Service Dependencies - Host Groups
Posted: Fri Mar 27, 2020 3:31 pm
by scottwilkerson
I believe this is possible if you have the following in your nagios.cfg