Merge pull request #3220 from Icinga/fix/filter-by-custom-variables

Fix filter by host custom variables
This commit is contained in:
lippserd 2018-01-11 11:40:22 +01:00 committed by GitHub
commit 6abb91421a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 19 additions and 0 deletions

View File

@ -964,6 +964,12 @@ abstract class IdoQuery extends DbQuery
$leftcol = 'h.host_object_id';
}
$mapped = $this->getMappedField($leftcol);
if ($mapped !== null) {
$this->requireColumn($leftcol);
$leftcol = $mapped;
}
$joinOn = sprintf(
$this->customVarsJoinTemplate,
$leftcol,

View File

@ -18,6 +18,9 @@ class ServicegroupQuery extends IdoQuery
'hostgroups' => array(
'hostgroup_name' => 'hgo.name1'
),
'hosts' => array(
'h.host_object_id' => 's.host_object_id'
),
'instances' => array(
'instance_name' => 'i.instance_name'
),
@ -70,6 +73,16 @@ class ServicegroupQuery extends IdoQuery
);
}
/**
* Join hosts
*
* This is required to make filters work which filter by host custom variables.
*/
protected function joinHosts()
{
$this->requireVirtualTable('services');
}
/**
* Join instances
*/