Use dummy Check in different states

Hello everyone

I hope one of you can help me with my current blocking problem on my Icinga config file. What I am trying to realize is: I have a parent Host (ESXi) which observes in my example three other hosts, and if 2 of 3 child host are down the parent Host is going in “down” state. That works so far with using the Dummy Check on the parent Host.

here is my config file so far :

object Host "ESXi - Parent" {
  import "generic-host-no-ping"

  vars.cluster_nodes = [ "ESXi - Child1", "ESXi - Child2", "ESXi - Child3" ]

  check_command = "dummy"
  vars.dummy_state = {{
   var limit = 2
   var cluster_nodes = macro("$cluster_nodes$")
   var up = 0
   var down = 0

for (node in cluster_nodes) {
      if (get_host(node).state > 0) {
        down += 1
      } else {
        up += 1
        }
      }
    if (down <= limit) {
      return 0 //Host UP
    } else {
      return 2 //Host Down
    }
}}


  vars.dummy_text = {{
    var output = ":Cluster hosts:\n"
    var cluster_nodes = macro("$cluster_nodes$")

    for (node in cluster_nodes) {
      output += node + ": " + get_host(node).last_check_result.output + " STATE: " + get_h$
    }

    return output
  }}

}

And now I am trying to set the Parent Host in Critical state when for example 1 of 3 hosts is down. I know the dummy host can be 0 (UP) 1 (UNREACHABLE) or 2 (DOWN). Is there any way of bringing the parent host in the critical state? I was looking up for quite a while now and couldn’t find a solution.

Thank you in advanced :slight_smile:
Pia

Hello @PiMA!

Hosts can be only UP or DOWN:

https://icinga.com/docs/icinga2/latest/doc/03-monitoring-basics/#host-states

Only services can be CRITICAL.

Best,
AK

2 Likes

You can think of the DOWN state as the hosts’ equivalent of the CRITICAL state on a service :slight_smile:

1 Like

thank you for your help this is clear now. I will try to find a work around to realize this.

I need more this warning and critical difference for my hosts. But thank you =)

I don’t know what you had in mind, but I think the business process module could be interesting for you to look at? :slight_smile:

I’m going to take a look. But this seems like what i was looking for. Thank you :slight_smile:

1 Like