Hi all,
I am attempting to not monitor for ping/icmp for a particular set of machines. All objects in our environment are monitored for ping/icmp, but I have just a handful of objects that don’t respond to icmp requests by the vendor’s software’s design.
The only unique identifier that I can find for these machines in Icinga is a Notes property with the word “VTMN”.
The current code I’ve attempted to use, which unfortunately does not work, is the following:
apply Service for (ping => config in host.vars.ping) {
import "generic-service"
check_command = "ping4"
zone=config.src
vars += config
vars.delay=2m
vars.ping_wrta=550
vars.ping_crta=600
vars.ping_wpl = 20
vars.ping_cpl = 40
assign where host.notes != "VTMN"
}
Other than the unique word in the Notes property, how can I specify not to monitor that set of machines? Of course, I could hardcode the names, but I don’t believe that is ideal, since it’s possible in the future we would add more of those machines, so I’d like to be able to make it dynamic.
I’ve also attempted adding them as a Custom Host object, with no ping, which works fine and I can monitor other properties that I want, but then that means I have duplicate objects in Icinga based on my testing since Icinga automatically ingests new Objects in our environment.
Alternatively, would I use an if statement in the code above? So something like:
if (host.notes == "VTMN") {
check_command = "dummy"
vars.dummy_state = 0
vars.dummy_text = UP
}
So then as an example:
apply Service for (ping => config in host.vars.ping) {
if (host.notes == "VTMN") {
check_command = "dummy"
vars.dummy_state = 0
vars.dummy_text = UP
}
else {
import "generic-service"
check_command = "ping4"
zone=config.src
vars += config
vars.delay=2m
vars.ping_wrta=550
vars.ping_crta=600
vars.ping_wpl = 20
vars.ping_cpl = 40
}
}
Any thoughts or feedback would be greatly appreciated, and if any additional info is needed, please let me know.
Thanks!
- Icinga Web 2 version - 2.11.4
- Used modules and their versions (System - About) - Grafana, Icingadb, Monitoring
- Web browser used - Chrome, Edge, etc
- Icinga 2 version used (
icinga2 --version
) - 2.11.4 - PHP version used (
php --version
) - 8.1.2-1ubuntu2.13 - Server operating system and version - Ubuntu Linux