Server Fault Asked by Peter Nunn on December 25, 2020
I’m trying to turn off the http check for one host in my icinga2 setup. I’m new to this and am just going around in circles.
I’m using the standard install and have it successfully running against a number of linux sattelite machienes happily, but a few don’t have web servers running on them so I want to turn off the http check.
Following some inconclusive looking around I came across Avoiding Common Pitfalls with Apply Rules which seem to do what I want with the vars.no_web_check variable, but try as I might I can’t get it to work.
I’ve added the ignore line to groups.conf for the http test, but when I set up my host config in repository.d/hosts/ as follows
object Host "kvm3.infoteq.com.au" {
import "satellite-host"
check_command = "cluster-zone"
vars.no_web_check = true
}
}
I get an error when I try and reload icinga2 saying there is a problem with this config, Error: Value computed is not used.
The modified http stanza from groups.conf file is
object ServiceGroup "http" {
display_name = "HTTP Checks"
assign where match("http*", service.check_command)
ignore where host.vars.no_web_check
}
Is this where I should be adding this check? There must be an easier way to do this.
Can you not just the set vars.web_check = false
and then in groups.conf:
assign where host.vars.web_check
which will just apply this service to the hosts where you have only web_check set to true. I think this should work as well:
assign where match("http*", service.check_command) && host.vars.web_check
Answered by Tux_DEV_NULL on December 25, 2020
For your service, I would try to use a service declaration and not a servicegroup, for example :
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"]
}
This service is applied to all hosts where their names are in the assign
declaration.
You can use ignore
to exclude some hosts. It's the syntax of assign
.
Answered by Sorcha on December 25, 2020
Get help from others!
Recent Questions
Recent Answers
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP