Proper way to create service dependency in Nagios xi

This support forum board is for support questions relating to Nagios xi, our flagship commercial network monitoring solution.
mlabbepg
Posts: 30
Joined: Fri Apr 16, 2021 1:10 pm

Proper way to create service dependency in Nagios xi

Post by mlabbepg »

Hi,

I'm having a hard time figuring out proper way to create service dependencies.

Most threads I found point to that part of documentation:
Nagios xi document on Service dependencies: https://support.nagios.com/kb/article/n ... s-505.html

Which explains the thinking, but no explanation on the different menu options, or step-by-step instructions to configure a service dependency properly in Nagios xi (I know it can change depending on user choices, but I was expecting to find at least one or two examples).

I have found that youtube video that explains step by step how to create dependencies for services on a single host:
https://www.youtube.com/watch?v=jstfUxm ... =BradHyman

However, our setup is relying heavily on groups to avoid deduplication as much as possible.

I ususually create services directly in CCM, grouping services in "ncpa-all", "ncpa-common" or "hostname" configs and add hosts/hostgroups to the configs. It's working great that way so far.


Now I'm trying to set all NCPA services dependant on the "NCPA Version" service on the same host.

So far we have around 100 hosts and probably 1000 NCPA-based services in our config (and another 500 based on NRPE, SNMP, etc.)
so obviously we don't want to create separate service dependencies for every single host.

All services run through NCPA Agent have a default 5/1/5 (CI/RI/CA) check setting.
The NCPA Version service has 5/1/4 so it goes down HARD before the others.

All hosts with NCPA Agent are member of a NCPA-Hosts hostgroup.
All service checks using NCPA (except NCPA Version to avoid conflict in the dependency below) are member of a NCPA-Services servicegroup.

So I've defined service dependency that way:

Config name: NCPA-Dependency
Execution failure criteria: selected Warning, Critical, Unknown and Pending
Service Dependancy Period: 24/7 (doesn't matter)

Manage Host Groups: NCPA-Hosts
Manage Services: NCPA Version

Manage Dependent Host Groups: NCPA-Hosts
Manage Dependent Sevices: CPU Usage (would leave empty but Nagios xi complains that I need to set at least 1 service)
Manage Dependent Service Group: NCPA-Services


This seems to stop processing all NCPA-Services on all hosts when NCPA Version check fails on a single host, which is definitely not what we're trying to achieve here.

I'm guessing this is due to the NCPA-Hosts defined in Manage Host Groups, but I don't see how I can apply that dependency to behave like I mentioned earlier (make all NCPA services on each host depend on the NCPA Version service on the same host).

Is it possible at all?
ssax
Dreams In Code
Posts: 7682
Joined: Wed Feb 11, 2015 12:54 pm

Re: Proper way to create service dependency in Nagios xi

Post by ssax »

I generally use these (they are for Core but xi sits atop Core so it's still relevant)

https://assets.nagios.com/downloads/nag ... ncies.html
https://assets.nagios.com/downloads/nag ... dependency

I think the only way to do that currently is to add it into a file in /usr/local/nagios/etc/static because xi doesn't currently allow you to select the ! option in the web interface which would be required for this:

/usr/local/nagios/etc/static/static_escalations.cfg

Code: Select all

define servicedependency {
    hostgroup_name                      NCPA-Hosts
    service_description                 NCPA Version
    dependent_service_description       *,!NCPA Version
    execution_failure_criteria       w,u,c,
    notification_failure_criteria    w,u,c,
    dependency_period                24x7
}
Then apply configuration.

NOTE: All of the hosts in that hostgroup need to have the NCPA Version service otherwise the configuration will not validate properly.
mlabbepg
Posts: 30
Joined: Fri Apr 16, 2021 1:10 pm

Re: Proper way to create service dependency in Nagios xi

Post by mlabbepg »

Forgot to reply earlier, but that worked.

Thanks!
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises

Re: Proper way to create service dependency in Nagios xi

Post by scottwilkerson »

mlabbepg wrote:Forgot to reply earlier, but that worked.

Thanks!
Locking thread
Former Nagios employee
Creator:
Human Design Website
Get Your Human Design Chart