Зависимости в Icinga2
13 Dec 2017
local_offer
Icinga2
apply Dependency "host-state-from-ping" to Host {
parent_service_name = "ping"
host.vars.dummy_state = {
{
if (get_service(host.name, "ping").state > 0) {
## В icingaweb2 не всегда корректно отображается актуальная иконка
#if (host.icon_image == "/icingaweb2/plsatin/img/computer_16.png") {
# host.icon_image = "/icingaweb2/plsatin/img/computer_16_gray.png"
#}
return 3
} else {
return 0
}
}
}
assign where host.vars.endpoint_host
}
apply Dependency "service-state-from-ping" to Service {
parent_host_name = host.name
parent_service_name = "ping"
disable_checks = true
assign where host.vars.endpoint_host
}
apply Dependency "services-command_endpoint-agentless" to Service {
service.command_endpoint = host.command_endpoint
assign where host.vars.command_endpoint
}
Просмотр зависимостей:
curl -k -s -u root:icinga 'https://localhost:5665/v1/objects/dependencies' | python -m json.tool