Parent and child service dependency

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
deek
Posts: 194
Joined: Fri Apr 26, 2019 2:01 am

Parent and child service dependency

Post by deek »

Hi

We are working on a request where we have two services running on different hosts. We need to set up a dependency monitoring in Nagios.
For example:

HostA ---- ServiceA
HostB ---- ServiceB


If ServiceA is CRITICAL and also ServiceB is CRITICAL then alert notification for ServiceA should be sent.
If ServiceA is CRITICAL and ServiceB is OK then no alert notifications should be sent for both ServiceA and ServiceB.

How can we achieve this in Nagios Xi or in Nagios core.


Thanks
Deek
ssax
Dreams In Code
Posts: 7682
Joined: Wed Feb 11, 2015 12:54 pm

Re: Parent and child service dependency

Post by ssax »

You can see here for dependencies:

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


You may want to use the check_cluster plugin to do this as well:

https://assets.nagios.com/downloads/nag ... sters.html

The check cluster plugin checks the status of multiple services and alerts based on the status of both.

1. Make sure that you are monitoring the services (PING in this example) on all servers (you can disable notifications for them, this is important so you don't notifications when they are down), these service checks are what will be used by the check_cluster plugin and need to exist.

2. Create a new command:
- Command Name: check_service_cluster
- Command Line: $USER1$/check_cluster --service -l $ARG1$ -w $ARG2$ -c $ARG3$ -d '$ARG4$'
- Command Type: check command

3. Create the service cluster check:
- Description: PING_Cluster
- Check command: check_service_cluster
- $ARG1$: PING_Cluster
- $ARG2$: 3 <- Set this to one MORE than your total number of services (3 services + 1 = 4) - We don't care about warnings in this example
- $ARG3$: 1 <- Set this to one LESS than your total number of services (3 services - 1 = 2)
- $ARG4$: $SERVICESTATEID:yourhost1:PING$,$SERVICESTATEID:yourhost2:PING$,$SERVICESTATEID:yourhost3:PING$

NOTE: The hostname and the service description in $ARG4$ need to be exact (case sensitive).

The way this would work is that whenever that service is not running on ANY of the nodes it would generate a CRITICAL. So the check_cluster uses the statuses of all of each individual service checks to determine if there is an issue and since you disabled the notifications on the individual services you won't get those notifications, this is the service that will do the notifying.
deek
Posts: 194
Joined: Fri Apr 26, 2019 2:01 am

Re: Parent and child service dependency

Post by deek »

Ssax -- thanks for your suggestions.

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

You may now close the case.
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: Parent and child service dependency

Post by scottwilkerson »

deek wrote:Ssax -- thanks for your suggestions.

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

You may now close the case.
Great!

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