Syntax for restrictions

I’m trying to hide hosts and services from a user role whenever a host or service is a member of a hostgroup or a servicegroup called “hidden”. This is what I have, but it is not working:

Authentication/User/Roles

monitoring/​filter/​objects    (hostgroup_name!=hidden||servicegroup_name!=hidden)

What am I doing wrong? Is there a documented syntax for the filter?

I started looking in library/Icinga/Data/Filter, but my head exploded.

I got it to work using:
!(hostgroup_name=hidden||servicegroup_name=hidden)

Still wondering about the filter expression syntax. Closest doc I can find is here where it references “filter expression”.

1 Like

Scroll down there a bit, then you’ll find some example restrictions.

Note that the OR operator is a single pipe (a|b), not a double one.
The negation wouldn’t have been necessary, if you just have used the AND operator. (hostgroup_name!=hidden&servicegroup_name!=hidden)

The filter syntax is very basic:
Logical Operators: |, &, !
Grouping Operators: (, )
Relational Operators: =, !=, >, >=, <, <=

2 Likes