Skip to content
This repository has been archived by the owner on Jan 15, 2019. It is now read-only.

[dev.icinga.com #4318] Filtering hosts by multiple hostgroups via OR and AND results in duplicate and empty output #1157

Closed
icinga-migration opened this issue Jun 15, 2013 · 5 comments

Comments

@icinga-migration
Copy link

This issue has been migrated from Redmine: https://dev.icinga.com/issues/4318

Created by dmikulski on 2013-06-15 09:55:19 +00:00

Assignee: (none)
Status: New
Target Version: Backlog
Last Update: 2015-05-18 12:17:45 +00:00 (in Redmine)


In the example there are two hosts each belonging to multiple hostgroups:

web-1 -> windows-server, web-server, ...
app-1 -> windows-server, application-server, ...

Filtering for "all web-server running on windows (windows-server)" via OR result in:
3 Hosts (2x web-1, 1x app-1)

via AND result in empty grid.

Sample screens in attach.

Attachments

@icinga-migration
Copy link
Author

Updated by dmikulski on 2013-06-15 10:11:37 +00:00

Should show:
Probably every Host once! :-)

@icinga-migration
Copy link
Author

Updated by mfriedrich on 2013-06-26 10:56:21 +00:00

try adding another "AND" node below the root "AND" and drag your hostgroups there.

@icinga-migration
Copy link
Author

Updated by dmikulski on 2013-07-02 07:21:05 +00:00

Hey dnsmichi,

same result as in screen filtering_hostgroups_and.png
Nothing is shown.

I think this is a problem that can't be solved by a logical conjunction in the gui but probably needs some code.
The problem comes from the query that is generated by the defined filter:

h.hostgroups hg hg.object ohg ohg.name1 AS hostgroup\_name

The query results in a list of services where every service occurs as often as its' host is associated to a hostgroup. Afterwards the filter like shown in the screens above, checks for "web-server OR windows-server" in hostgroup_name. All fields except those are filtered resulting in still showing two entry for one service because their host belongs to two hostgroups.

I solved a problem in open problems view where I wanted to filter those open problems belonging to a specific hostgroup. I think it could be related to this. I solved it with a subselect in a where-clause. Maybe it can be integrated into the filter somehow. You can find it below:

COALESCE (s.host\_object\_id, h.host\_object\_id) NOT IN ( SELECT DISTINCT nhgm.host\_object\_id AS HG\_HOST\_OBJECT\_ID FROM IcingaHostgroupMembers nhgm INNER JOIN nhgm.hostgroup nhgmhg INNER JOIN nhgmhg.object nhgmho WHERE nhgmho.name1 IN (${param.nothostgroup}))

BR

@icinga-migration
Copy link
Author

Updated by mfrosch on 2013-10-02 12:26:56 +00:00

  • Tracker changed from Bug to Feature

Problem:
This kind of AND can not work with the way the queries work right now.

Mostly the same happens with customvars or other things.

The extra information is joined 1-n and then filtered by WHERE.

One would have to create individual joins per filter argument, which would allow to combine the WHEREs in a single dataset.

@icinga-migration
Copy link
Author

Updated by berk on 2015-05-18 12:17:45 +00:00

  • Target Version set to Backlog

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants