Is it possible to have mutual dependencies for events?

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
Locked
aramisbackwards
Posts: 13
Joined: Tue Nov 29, 2016 1:48 am

Is it possible to have mutual dependencies for events?

Post by aramisbackwards »

I want to setup a network structure that works as below:

Code: Select all

Group 1
  (Main) Host 1 
  Host 2 
  Host 3

Group 2
  (Main) Host 4
  Host 5
  Host 6
What I want for this structure is for a notification / event_handler to be called if and only if all three hosts under a group are down/unreachable, else, simply default to single host
logic (which will probably have notifications disabled). All hosts in group 1 are up, and if only one or two are down there shouldn't be any notification. But if all three are down I want a notification sent AND I want to run an event_handler. Is it possible to have a dummy host or something that will never go down that depends on the three and can be forced down if those other three do?

Each host is monitored by check_host_alive / check_ping and I want to check the result of those check_pings/host_alives for the three hosts in the group.

If that isn't possible, should i try instead to define a host_dependency which calls checks for the other hosts if it goes into a critical state? If I want to call an event_handler for a custom script this seems to be non-trivial since there are two dependent hosts.



Should I be defining it instead as a Service which runs on the three hosts
User avatar
mcapra
Posts: 3739
Joined: Thu May 05, 2016 3:54 pm

Re: Is it possible to have mutual dependencies for events?

Post by mcapra »

The short answer to your topic title is no.
Is it possible to have a dummy host or something that will never go down that depends on the three and can be forced down if those other three do?
I would define a separate service (or host) check to watch those 3 hosts in each group, then assign that service your "all 3 are down" handler. This would likely involve writing some sort of custom script to get the state of those 3 hosts. The JSON Query Generator would probably be handy for this:
http://<nagios_core_host>/nagios/jsonquery.html

You could also just bake that logic into your event handler for the 3 individual checks.
Former Nagios employee
https://www.mcapra.com/
Locked