You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Created by mwaldmueller on 2015-11-04 09:36:21 +00:00
Assignee: mwaldmueller
Status: Resolved (closed on 2015-11-25 15:49:13 +00:00)
Target Version: 2.4.1
Last Update: 2015-11-26 08:58:31 +00:00 (in Redmine)
Icinga Version: 2.3.11
Backport?: Already backported
Include in Changelog: 1
The following example doesn't work correctly:
object Host "cluster-host-01" {
check_command = "dummy"
vars.dummy_state = 2
vars.dummy_text = "This host is down."
}
object Host "cluster-host-02" {
check_command = "dummy"
vars.dummy_state = 0
vars.dummy_text = "This host is up."
}
object Host "cluster" {
check_command = "dummy"
vars.cluster_nodes = [ "cluster-host-01", "cluster-host-02" ]
vars.dummy_state = {{
var up_count = 0
var down_count = 0
var cluster_nodes = macro("$cluster_nodes$")
for (node in cluster_nodes) {
if (get_host(node).state > 0) {
down_count += 1
} else {
up_count += 1
}
}
if (up_count >= down_count) {
return 0 //same up as down -> UP
} else {
return 1 //something is broken
}
}}
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 + "\n"
}
return output
}}
}
The problem ist that returncode "1" (= WARNING) in case of a broken state for a host is interpreted as "UP", so you have to change the returncode to "2" (= DOWN).
Updated by mfriedrich on 2015-11-26 08:58:31 +00:00
Subject changed from Example in Access Object Attributes at Runtime doesn't work correctly to Documentation example in "Access Object Attributes at Runtime" doesn't work correctly
This issue has been migrated from Redmine: https://dev.icinga.com/issues/10528
Created by mwaldmueller on 2015-11-04 09:36:21 +00:00
Assignee: mwaldmueller
Status: Resolved (closed on 2015-11-25 15:49:13 +00:00)
Target Version: 2.4.1
Last Update: 2015-11-26 08:58:31 +00:00 (in Redmine)
The following example doesn't work correctly:
The problem ist that returncode "1" (= WARNING) in case of a broken state for a host is interpreted as "UP", so you have to change the returncode to "2" (= DOWN).
Attachments
Changesets
2015-11-25 15:48:40 +00:00 by mwaldmueller 7ecc6f7
2015-11-25 15:49:33 +00:00 by mwaldmueller f79b073
2015-11-26 09:35:24 +00:00 by mfriedrich ef0e03f
2015-11-26 09:35:41 +00:00 by mfriedrich c983fde
The text was updated successfully, but these errors were encountered: