Page 1 of 2

Dependency Mapping - Host & Service to all monitors

Posted: Tue Mar 24, 2020 5:37 am
by veeravamsi
Hi Team,

Im trying to build Dependency mapping at Host level to check for NCPA Agent Status so is it possible to Create hierarchical dependency to avoid running monitors based on scenario :

Scenario 1 : Server is not reachable
Host Down : PING fails
Agent Down : Agent API is NOT responding

Scenario 2 : Server is Up but Agent is NOT responding
Host Up: PING Success
Agent Down : Agent API is NOT responding

All underlying monitors should not run in either of the scenarios - Disk , CPU , Memory , etc

How can we create a dependency so that if either Host Down or Agent Down then none of underlying monitors run ?

--Vamsi

Re: Dependency Mapping - Host & Service to all monitors

Posted: Tue Mar 24, 2020 3:54 pm
by benjaminsmith
Hello Vamsi,

You can use service dependencies in Nagios XI to set this up. So if you create a ping check as a service for the server, and then define service dependencies between this check and the other services, you can configure the execution and notification settings as desired.

Service dependencies can be configured in Nagios XI by going to Configure > CCM > Advanced > Service Dependencies (see screenshot).
service-dependencies.png
You'll find documentation explaining the settings below.
https://support.nagios.com/kb/article.php?id=505
https://assets.nagios.com/downloads/nag ... ncies.html

Let me know if that will work for your environment.

Re: Dependency Mapping - Host & Service to all monitors

Posted: Wed Apr 01, 2020 4:54 am
by veeravamsi
Perfect . Im trying to Create NCPA Agent Monitor ( using check_http ) to test Agent Availability before running any of the underlying monitors. So this approach of Service Dependency works fine , However two questions :

1. We have to create this dependency for each server ? Meaning we have to manually select the Services ( CPU , Memory , Disk , etc ) and if these are varying ( means some servers have Service check ? ) then its lot of complexity or involves manual work ?
Capture.PNG
2. Also can we include this as part of Template Deployment ? Or is there a way to make this global just like we change host_dependency_check=1 or some variable to say dont run any of the monitors if Host is unreachable ?

Do let us know if there is better way of handling this situation : My goal is not run underlying services if Host or Agent is not working ?

--Vamsi

Re: Dependency Mapping - Host & Service to all monitors

Posted: Wed Apr 01, 2020 3:23 pm
by benjaminsmith
Hi Vamsi,

It sounds like this approach will work for you. Below are the answers to your questions.
We have to create this dependency for each server? Meaning we have to manually select the Services ( CPU , Memory , Disk , etc ) and if these are varying ( means some servers have Service check ? ) then its lot of complexity or involves manual work ?
1. There isn't a template for service dependencies, so it would take some manual selection to set this up, but you might be able to save some time organizing the services into groups.
Also can we include this as part of Template Deployment? Or is there a way to make this global just like we change host_dependency_check=1 or some variable to say dont run any of the monitors if Host is unreachable?
2. There is a configuration setting the main Nagios.cfg file that will allow you to disable service checks when the host is down. This is a global setting, but very easy to implement.
See:
Nagios XI - Service Dependencies

Re: Dependency Mapping - Host & Service to all monitors

Posted: Wed Apr 01, 2020 11:21 pm
by veeravamsi
Thanks Benjamin . I cannot access the document referred on the KB link .

So if i want to make 'NCPA Agent' as master Service across all Services , Do we need to have separate Entry for each Server ? or can we logically using Host/Service Groups and make them generic ?

On the second point - Do you have any other option on nagios.cfg ( similar to host_down_disable_service_checks=1 ) which i set for NCPA Agent Service like ncpa_service_down_disable_checks=1

Re: Dependency Mapping - Host & Service to all monitors

Posted: Thu Apr 02, 2020 4:11 pm
by ssax
We can't either, @benjaminsmith says he's going to try to track that article down.

How many total NCPA services do you think your XI system will have once you have them all in?

See here for examples of some time saving tips/tricks of how it can be setup:

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

The "ncpa_service_down_disable_checks" functionality doesn't exist. You'll only be able to do it with service dependencies.

Thank you

Re: Dependency Mapping - Host & Service to all monitors

Posted: Fri Apr 03, 2020 3:21 am
by veeravamsi
Awesome :) . Do you have any sample Rule based on your experience that helps us to create dependency Mapping for

NCPA Agent Status ( Primary or Main Service ) and rest all are dependent services.

As we will have 1000's of Servers having NCPA Agent and writing separate rule for each one is not ideal solution. So i was thinking to have Single Rule that helps us do this Job . Any suggestions ?

Re: Dependency Mapping - Host & Service to all monitors

Posted: Fri Apr 03, 2020 2:28 pm
by ssax
I'm struggling to find a way to do this without you defining them individually for each host.

My recommendation would probably be for you to change your host check from a Ping check to an NCPA agent check (just set it up like the master service), then set host_down_disable_service_checks=1 in your /usr/local/nagios/etc/nagios.cfg, and then restart the nagios service.

That way if the agent is down, the host will still nofify you, but the other NCPA services for the host won't run, which accomplishes what you're trying to do.

Those are really your only options after trying to get this done in a lab environment.

Re: Dependency Mapping - Host & Service to all monitors

Posted: Sun Apr 05, 2020 11:34 am
by veeravamsi
Thank you for your suggestion . This is the current configuration we have ( NCPA Check @ Host Level ) but when NCPA is not communicating it triggers Host Down error which is what we are trying to avoid.

Re: Dependency Mapping - Host & Service to all monitors

Posted: Mon Apr 06, 2020 12:32 pm
by ssax
How often do you have it that the agent is down and the host is still pinging? Is this a common problem in your environment?