Please add specific examples, snippets, code, etc. here.
Global Calculations
apply for
- Nested apply for: https://monitoring-portal.org/t/nested-apply-service-for/3965
State to String
globals.state_to_string = function(state, is_host) {
if (is_host) {
if (state == 0) {
return "Up"
} else if (state == 1) {
return "Down"
} else {
Log(LogWarning, "state_to_string", "Unknown host state " + state + " provided.")
}
} else {
if (state == 0) {
return "OK"
} else if (state == 1) {
return "Warning"
} else if (state == 2) {
return "Critical"
} else if (state == 3) {
return "Unknown"
} else {
Log(LogWarning, "state_to_string", "Unknown service state " + state + " provided.")
}
}
}
Host array from specific group
vars.cluster_nodes = {{
var res = []
for (h in get_objects(Host)) {
if ("workers" in h.groups) {
res.add(h.name)
}
}
return res
}}