Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Filter to exclude hosts/services that are member of a specific group #2934

Closed
peng42 opened this issue Aug 31, 2017 · 2 comments · Fixed by #3457
Closed

Filter to exclude hosts/services that are member of a specific group #2934

peng42 opened this issue Aug 31, 2017 · 2 comments · Fixed by #3457
Assignees
Labels
area/monitoring Affects the monitoring module enhancement New feature or improvement
Milestone

Comments

@peng42
Copy link

peng42 commented Aug 31, 2017

Hi,

I couldn't find any doc or issue on this subject, please apology if already answered out somewhere.

Thanks a lot for all the work !

Expected Behavior

When using filters on hostgroups, hosts being member of more than one hostgroup :
When filtering out a hostgroup (eg : "hostgroup_name!=foo"), hosts matching this hostgroup (even if member of other hostgroups) should not be displayed.

Current Behavior

If host a is member of hostgroup foo AND hostgroup bar, using filter "hostgroup_name!=foo", host a is still displayed.
If host a is member of hostgroup foo and no other hostgroup, filtering works as expected.

Context

I couldn't find any other way to display strictly "all hosts but hosts which are member of group foo".
Encountered both in views (eg: /icingaweb2/monitoring/list/services?service_problem=1&hostgroup!=foo) and roles permissions (see documentation: 06-security).

Your Environment

  • Icinga Web 2 version: 2.4.1
  • Modules used: doc (2.4.1), monitoring (2.4.1), pnp (1.0.1)
  • Icinga2 version used: r2.6.0-1
  • Operating System and version: debian stretch (9.0), linux 4.9.0-2-amd64
  • Enabled features: checker command ido-mysql mainlog notification perfdata
@lippserd lippserd changed the title Negative filters on hostgroups Filter to exclude hosts that are member of a specific hostgroup Sep 20, 2017
@lippserd lippserd added the enhancement New feature or improvement label Sep 20, 2017
@lippserd
Copy link
Member

Hi,

Thanks for the report. Unfortunately excluding hosts with such a filter is not possible yet and somehow related to #1649. I can't tell you when this issue is going to be scheduled.

Best regards,
Eric

@lippserd lippserd changed the title Filter to exclude hosts that are member of a specific hostgroup Filter to exclude hosts/services that are member of a specific group Feb 26, 2018
@nilmerg nilmerg self-assigned this May 8, 2018
@nilmerg nilmerg added the area/monitoring Affects the monitoring module label May 8, 2018
@nilmerg nilmerg added this to the 2.6.0 milestone May 8, 2018
@nilmerg
Copy link
Member

nilmerg commented May 8, 2018

It's now scheduled for the next major release v2.6.0.

The issues we're looking at here are the following:

  1. Any amount of unequal comparisons to linked objects (e.g. list/hosts?hostgroup_name!=foo as well as list/hosts?hostgroup_name!=foo&service_description!=bar) return unwanted/wrong results.
  2. Multiple equal comparisons to linked objects (e.g. list/hosts?hostgroup_name=foo&hostgroup_name=bar) return no results at all. (See [dev.icinga.com #9241] Filter hosts and services by combined group memberships, e.g. servicegroup=(a&b) #1649)

Once this issue is resolved the following will change:

  1. Such a comparison returns less results. (i.e. No hosts which are a member of any hostgroup besides foo (while being a member of foo) and no hosts which have any other service other than bar (while having one named bar))
  2. This does return results. (i.e. All hosts which are a member of the hostgroups foo and bar)

Note that 1) is a breaking change. While the results are clearly wrong there are still results returned on which some may rely upon. This needs to be clearly mentioned in the release notes.

nilmerg added a commit that referenced this issue May 9, 2018
Still pretty basic, unoptimized and with many unfinished
parts. Working, though still requires some extensions
in existing query implementations.

refs #2934
nilmerg added a commit that referenced this issue May 11, 2018
Also allows to simplify the implementation as it was too
generic before.

refs #2934
nilmerg added a commit that referenced this issue May 14, 2018
Also allows to simplify the implementation as it was too
generic before.

refs #2934
lippserd pushed a commit that referenced this issue Jun 19, 2018
Still pretty basic, unoptimized and with many unfinished
parts. Working, though still requires some extensions
in existing query implementations.

refs #2934
lippserd pushed a commit that referenced this issue Jun 19, 2018
Also allows to simplify the implementation as it was too
generic before.

refs #2934
lippserd pushed a commit that referenced this issue Jun 21, 2018
lippserd pushed a commit that referenced this issue Jun 21, 2018
refs #2934

(EL): Alternative service group subquery filter:

```php
$this->joinVirtualTable('services');
$query->joinVirtualTable('members');
return ['sgm.service_object_id', 'so.object_id'];
```

But I think the committed solution is better.

Signed-off-by: Eric Lippmann <[email protected]>
lippserd pushed a commit that referenced this issue Jun 21, 2018
lippserd added a commit that referenced this issue Jul 18, 2018
lippserd added a commit that referenced this issue Jul 18, 2018
lippserd pushed a commit that referenced this issue Jul 18, 2018
lippserd pushed a commit that referenced this issue Jul 18, 2018
refs #2934

(EL): Alternative service group subquery filter:

```php
$this->joinVirtualTable('services');
$query->joinVirtualTable('members');
return ['sgm.service_object_id', 'so.object_id'];
```

But I think the committed solution is better.

Signed-off-by: Eric Lippmann <[email protected]>
lippserd pushed a commit that referenced this issue Jul 18, 2018
lippserd added a commit that referenced this issue Jul 18, 2018
lippserd added a commit that referenced this issue Jul 18, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/monitoring Affects the monitoring module enhancement New feature or improvement
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants