How does contains work in Director

Hey.
Today i noticed that one of my hosts wasnt sending notifications, eventhough he was down.
I found out that was the case, because he was in 2 hostgroups, which were both mentioned in the notification rule, but with or. So that makes sense, since he is in both groups he doesnt count.

Id like to change that though. Sadly there is no operator for inclusive or in director.
However the host groups both contain the same unique phrase which would easily work with a simple contains, but it doesnt.
Contains seems to only work as equals in director or am i missing a character something like * containedword * ?

Hey,

from the tooltip in the Director:
This allows you to configure an assignment filter. Please feel free to combine as many nested operators as you want. The "contains" operator is valid for arrays only. Please use wildcards and the = (equals) operator when searching for partial string matches, like in *.example.com

So what you actually want would be something like
host.vars.os = *RHEL* which is the Director’s equivalent to Icinga DSL match("*RHEL*", host.vars.os.)

Hope that helps,
Best,
Daniel

1 Like