I use Icinga to monitor network interfaces. Each network interface added as Icinga service and has 3-4 tags (custom service variable), e.g. “iftype=fabric”, “l2bend=switch1”, etc. I have a notification apply rule with ‘service.enable_notifications && service.check_command == “check_iftraffic64”’ assign rule. It works and Icinga sends notifications if there is an issue with an interface.
I would like to use interface tags as a filter. For example, send notifications if service.vars.tags has “fabric” string. I tried many different combinations:
I tried ‘service.enable_notifications && service.check_command == “check_iftraffic64” && service.vars.tags[ “iftype”] == "fabric”’ notification rule filter and got many errors during the config deployment, e.g.:
critical/config: Error: Invalid field access (for value of type ‘Array’): ‘iftype’
critical/config: Error: Invalid field access (for value of type ‘String’): ‘iftype’
Oh, I thought that iftype is supposed to be a key/ an index of the array. Have you also tried the following? service.enable_notifications && service.check_command == "check_iftraffic64" && "iftype=fabric" in service.vars.tags. It should actually work like this.
Upgraded Icinga to the latest version (web 2.9.3 / php 7.3.29 / icinga 2.13.1). It is affected also.
Looks like there is a bug. Is there any way to escape the “=” charter?