0

我正在尝试在 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 将其显示为警告。(见下文)

在此处输入图像描述

请建议。

4

1 回答 1

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"```
于 2017-08-08T14:14:56.583 回答