From e181c57a7081b54e15ce5b5ebbeb0dd58daf885c Mon Sep 17 00:00:00 2001 From: Johannes Meyer Date: Thu, 18 Jun 2015 12:08:05 +0200 Subject: [PATCH] ServicestatusQuery: PostgreSQL grouping... refs #9009 --- .../Backend/Ido/Query/ServicestatusQuery.php | 26 +++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) diff --git a/modules/monitoring/library/Monitoring/Backend/Ido/Query/ServicestatusQuery.php b/modules/monitoring/library/Monitoring/Backend/Ido/Query/ServicestatusQuery.php index 723043b71..577ad16af 100644 --- a/modules/monitoring/library/Monitoring/Backend/Ido/Query/ServicestatusQuery.php +++ b/modules/monitoring/library/Monitoring/Backend/Ido/Query/ServicestatusQuery.php @@ -236,7 +236,6 @@ class ServicestatusQuery extends IdoQuery 'hgo.object_id = hg.hostgroup_object_id AND hgo.is_active = 1 AND hgo.objecttype_id = 3', array() ); - $this->group(array('so.name2', 'so.name1')); } /** @@ -281,7 +280,6 @@ class ServicestatusQuery extends IdoQuery 'sgo.object_id = sg.servicegroup_object_id AND sgo.is_active = 1 AND sgo.objecttype_id = 4', array() ); - $this->group(array('so.name2', 'so.name1')); } /** @@ -296,4 +294,28 @@ class ServicestatusQuery extends IdoQuery array() ); } + + /** + * {@inheritdoc} + */ + public function getGroup() + { + $group = array(); + if ($this->hasJoinedVirtualTable('hostgroups') || $this->hasJoinedVirtualTable('servicegroups')) { + $group = array('s.service_id', 'so.object_id'); + if ($this->hasJoinedVirtualTable('hosts')) { + $group[] = 'h.host_id'; + } + + if ($this->hasJoinedVirtualTable('hoststatus')) { + $group[] = 'hs.hoststatus_id'; + } + + if ($this->hasJoinedVirtualTable('servicestatus')) { + $group[] = 'ss.servicestatus_id'; + } + } + + return $group; + } }