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
Pia