ServicestatusQuery: Group by host- and servicegroup pk's if required
refs #9009
This commit is contained in:
parent
b24b650a94
commit
5ef56fc9b2
|
@ -3,6 +3,8 @@
|
||||||
|
|
||||||
namespace Icinga\Module\Monitoring\Backend\Ido\Query;
|
namespace Icinga\Module\Monitoring\Backend\Ido\Query;
|
||||||
|
|
||||||
|
use Zend_Db_Expr;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Query for service status
|
* Query for service status
|
||||||
*/
|
*/
|
||||||
|
@ -314,6 +316,50 @@ class ServicestatusQuery extends IdoQuery
|
||||||
if ($this->hasJoinedVirtualTable('servicestatus')) {
|
if ($this->hasJoinedVirtualTable('servicestatus')) {
|
||||||
$group[] = 'ss.servicestatus_id';
|
$group[] = 'ss.servicestatus_id';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($this->hasJoinedVirtualTable('hostgroups')) {
|
||||||
|
$selected = false;
|
||||||
|
foreach ($this->columns as $alias => $column) {
|
||||||
|
if ($column instanceof Zend_Db_Expr) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
$table = $this->aliasToTableName(
|
||||||
|
$this->hasAliasName($alias) ? $alias : $this->customAliasToAlias($alias)
|
||||||
|
);
|
||||||
|
if ($table === 'hostgroups') {
|
||||||
|
$selected = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($selected) {
|
||||||
|
$group[] = 'hg.hostgroup_id';
|
||||||
|
$group[] = 'hgo.object_id';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($this->hasJoinedVirtualTable('servicegroups')) {
|
||||||
|
$selected = false;
|
||||||
|
foreach ($this->columns as $alias => $column) {
|
||||||
|
if ($column instanceof Zend_Db_Expr) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
$table = $this->aliasToTableName(
|
||||||
|
$this->hasAliasName($alias) ? $alias : $this->customAliasToAlias($alias)
|
||||||
|
);
|
||||||
|
if ($table === 'servicegroups') {
|
||||||
|
$selected = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($selected) {
|
||||||
|
$group[] = 'sg.servicegroup_id';
|
||||||
|
$group[] = 'sgo.object_id';
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return $group;
|
return $group;
|
||||||
|
|
Loading…
Reference in New Issue