(Please find below the module’s versions of my setup)
Using Director, I’ve created a data list (containing hosts names, but that could contain really any random data some day), and in a service apply rule, I’m trying to use it this way (pseudo code, but you get the idea) :
assign where host.name not in $my_custom_data_list$
I have absolutely no idea how to use Director to make it use the data list, neither which would be the correct syntax (so probably not with these funny dollars).
At present, obviously, my apply rule does not understand that it has to look into this data list.
Is there a way to make it use the globally defined data list?
Thank you
Nicolas
The modules versions:
Icinga Web 2 Version 2.11.4
PHP Version 7.4.33
icinga/icinga-php-thirdparty 0.11.0
icinga/icinga-php-library 0.12.0
Loaded Modules
director 1.10.2
icingadb 1.0.2
incubator 0.20.0
netbox 3.1.16.9
pve 0.1.0
vspheredb 1.7.1
x509 1.2.1
Though I’ve succeed using fields and exposing them in other contexts, here in this case, I’m stuck : I can add a field that is using the data list (and possibly add a category), but then, which template should I add this field to?
My service apply rule imports a service template, so I added the field to this service template.
In the apply rules webgui, it does not seem to allow me to use the data list in the “contains” or “in” fields…
Coming back to this issue, I finally understood what was missing in my non-understanding : I was trying to compare a variable to another variable, using Director.
I found no mean to do this, as long I was using Director.
When I switched to writing a /etc/icinga2/conf.d/custom.conf file, I was able to do that :
const EXCLUDE_LIST = [ "host1", "host2" ]
apply Service "svcaplyrul1" {
import "somesvc"
assign where host.vars.something01 == "true" !( host.name in EXCLUDE_LIST )
import DirectorOverrideTemplate
}
Now this rule is written, I can only change the content of EXCLUDE_LIST, maybe placing it in another specific file.
Using the Director web GUI, it was not possible to reach this : every try ended up with Director converting the left or right part of the comparison into a string (adding double quotes).
So I’m a bit sad not to be able to keep a 100% web setup, but sometimes, one has to keep going.