在icinga2中closures一台主机的检查

我试图在我的icinga2设置中closures一个主机的http检查。 我是新来的,只是绕圈而去。

我正在使用标准安装,并且已经成功地在一些linux卫星机器上运行,但是有一些没有运行web服务器,所以我想closureshttp检查。

经过一些没有结果的环顾四周,我遇到了避免与应用规则常见的陷阱似乎做我想要的vars.no_web_checkvariables,但尝试我可能无法得到它的工作。

我为httptesting添加了ignore.nbsp; groups.conf,但是当我在repository.d / hosts /中设置我的主机configuration时,如下

object Host "kvm3.infoteq.com.au" { import "satellite-host" check_command = "cluster-zone" vars.no_web_check = true } } 

当我尝试重新加载icinga2并说这个configuration存在问题时,出现错误:错误:计算出的值未被使用。

来自groups.conf文件的修改的http节是

  object ServiceGroup "http" { display_name = "HTTP Checks" assign where match("http*", service.check_command) ignore where host.vars.no_web_check } 

这是我应该添加此检查? 必须有一个更简单的方法来做到这一点。

为了您的服务,我会尝试使用服务声明而不是服务组,例如:

 apply Service "Interface " for (interface_name => interface_config in host.vars.interfaces){ import "generic-service" check_command = "check_netint_w2012_byifname" vars.interface = interface_name vars.warning= "650000" vars.critical ="800000" vars.snmp_communaute = host.vars.snmp_communaute vars += interface_config assign where host.name in ["server1", "server2", "server3"] } 

这个服务被应用到所有名字在assign声明中的主机。

您可以使用ignore来排除一些主机。 这是assign的语法。

你可以不只是设置vars.web_check = false ,然后在groups.conf:

assign where host.vars.web_check

它只会将这个服务应用到只有web_check设置为true的主机上。 我认为这也应该如此:

assign where match("http*", service.check_command) && host.vars.web_check