我正在尝试在icinga2中配置check_cluster。我们目前在8台服务器上进行了健康检查。我们想要通知3个或更多服务器上的健康检查是否至关重要。
apply Service "Cluster Service Health Check" {
check_command = "check_cluster"
vars.check_cluster_service = true
vars.check_cluster_label = "Health Check"
vars.check_cluster_warning = 2
vars.check_cluster_critical = 3
vars.check_cluster_data = {{
get_object(Service, "server1.net!Elements Health Check").state + "," + get_object(Service, "server2.net!Elements Health Check").state + "," + get_object(Service, "server3.net!Elements Health Check").state + "," + get_object(Service, "server4.net!Elements Health Check").state + "," + get_object(Service, "server5.net!Elements Health Check").state + "," + get_object(Service, "server6.net!Elements Health Check").state + "," + get_object(Service, "server7.net!Elements Health Check").state + "," + get_object(Service, "server8.net!Elements Health Check").state
}}
assign where host.name == "chicago-cluster"
}
当我们应用上述逻辑时,我们会看到以下3健康检查严重。
CLUSTER WARNING: Elements Health Check: 5 ok, 0 warning, 0 unknown, 3 critical
但Icinga2将其显示为警告。 (见下文)
请建议。
答案 0 :(得分:0)
你只需要将@添加到临界值。
``` 应用服务“群集服务运行状况检查”{ check_command =“check_cluster”
vars.check_cluster_service = true
vars.check_cluster_label = "Health Check"
vars.check_cluster_warning = 2
vars.check_cluster_critical = @3
vars.check_cluster_data = {{
get_object(Service, "server1.net!Elements Health Check").state + "," + get_object(Service, "server2.net!Elements Health Check").state + "," + get_object(Service, "server3.net!Elements Health Check").state + "," + get_object(Service, "server4.net!Elements Health Check").state + "," + get_object(Service, "server5.net!Elements Health Check").state + "," + get_object(Service, "server6.net!Elements Health Check").state + "," + get_object(Service, "server7.net!Elements Health Check").state + "," + get_object(Service, "server8.net!Elements Health Check").state
}}
assign where host.name == "chicago-cluster"```