Is it possible to set command_endpoint according to a current host-state?


this is about one of our Icinga2-instances we use along with icingaweb2 and the “bpm”-module for Icingaweb2. My question is just about Icinga2, wich we use to monitor the current state of some of those bpm’s to notify some usergroups if necessary. Those checks use “icingacli” to determine the bpm state.

Recently we added a second Icingaweb-Instance as a failover, in case the first one shows serious problems.

I am looking now for a solution to balance those icingacli-using-bpm-checks.

Best would be if I could do something like

object Service "my-BPM-Service" {
  if ( primary_icingaweb_host.state != 0 ) then {
    command_endpoint = secondary_icingaweb_host
  } else {
    command_endpoint = primary_icingaweb_host
  #[...] more service definition

The “host” connected to that service stays the same all the time.
Is there a standard to adress these kind of issues, when checks have to be run (command_endpoint) on different hosts - according to current states of the host?

So far I was unable to find a similar question.

One approach is to create two service objects and define dependencies between them. Or you create a third check that evaluate both service objects and acct accordingly.

1 Like


thanks for the reply!
We decided that it would confuse our uses to much to go with 2 checks each.

For the moment we use a template to switch between the instances if needed.

API based service modification would be the only other option.