Service Dependencies - Host Groups

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
User avatar
jenglish
Posts: 59
Joined: Sat Jun 09, 2018 3:51 pm
Location: Boyers, PA

Service Dependencies - Host Groups

Post 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.
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: Service Dependencies - Host Groups

Post 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.
Former Nagios employee
Creator:
Human Design Website
Get Your Human Design Chart
User avatar
jenglish
Posts: 59
Joined: Sat Jun 09, 2018 3:51 pm
Location: Boyers, PA

Re: Service Dependencies - Host Groups

Post by jenglish »

ah! Thanks @scottwilkerson. I'll give that a try and see if it works as expected.
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: Service Dependencies - Host Groups

Post by scottwilkerson »

jenglish wrote:ah! Thanks @scottwilkerson. I'll give that a try and see if it works as expected.
Sounds good
Former Nagios employee
Creator:
Human Design Website
Get Your Human Design Chart
User avatar
jenglish
Posts: 59
Joined: Sat Jun 09, 2018 3:51 pm
Location: Boyers, PA

Re: Service Dependencies - Host Groups

Post 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!
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: Service Dependencies - Host Groups

Post by scottwilkerson »

I believe this is possible if you have the following in your nagios.cfg

Code: Select all

use_regexp_matching=1
Former Nagios employee
Creator:
Human Design Website
Get Your Human Design Chart
Locked