From a0122763a676be970ce017421e3b1053e1838e3b Mon Sep 17 00:00:00 2001 From: Alexander Fuhr Date: Mon, 6 Oct 2014 11:37:33 +0200 Subject: [PATCH] Fix Queries: Summaries, Host, Service --- .../Monitoring/Backend/Ido/Query/GroupsummaryQuery.php | 4 +++- .../monitoring/library/Monitoring/DataView/HostStatus.php | 5 +++-- .../monitoring/library/Monitoring/DataView/ServiceStatus.php | 1 + modules/monitoring/library/Monitoring/Object/Service.php | 3 ++- 4 files changed, 9 insertions(+), 4 deletions(-) diff --git a/modules/monitoring/library/Monitoring/Backend/Ido/Query/GroupsummaryQuery.php b/modules/monitoring/library/Monitoring/Backend/Ido/Query/GroupsummaryQuery.php index c1e12a1ee..ec79ef63c 100644 --- a/modules/monitoring/library/Monitoring/Backend/Ido/Query/GroupsummaryQuery.php +++ b/modules/monitoring/library/Monitoring/Backend/Ido/Query/GroupsummaryQuery.php @@ -44,7 +44,6 @@ class GroupSummaryQuery extends IdoQuery $columns = array( 'object_type', 'host_state', - 'host_name' ); // Prepend group column since we'll use columns index 0 later for grouping @@ -61,6 +60,9 @@ class GroupSummaryQuery extends IdoQuery 'in_downtime' => 'host_in_downtime' ) ); + if (in_array('servicegroup', $this->desiredColumns)) { + $hosts->group(array('sgo.name1', 'ho.object_id', 'state', 'acknowledged', 'in_downtime')); + } $services = $this->createSubQuery( 'Status', $columns + array( diff --git a/modules/monitoring/library/Monitoring/DataView/HostStatus.php b/modules/monitoring/library/Monitoring/DataView/HostStatus.php index 60f224264..ff2ecaf91 100644 --- a/modules/monitoring/library/Monitoring/DataView/HostStatus.php +++ b/modules/monitoring/library/Monitoring/DataView/HostStatus.php @@ -64,7 +64,8 @@ class HostStatus extends DataView 'host_percent_state_change', 'host_modified_host_attributes', 'host_severity', - 'host_problem' + 'host_problem', + 'host_ipv4' ); } @@ -105,7 +106,7 @@ class HostStatus extends DataView public function getFilterColumns() { - return array('hostgroup', 'service_problems'); + return array('hostgroup', 'service_problems', 'servicegroup'); } public function isValidFilterTarget($column) diff --git a/modules/monitoring/library/Monitoring/DataView/ServiceStatus.php b/modules/monitoring/library/Monitoring/DataView/ServiceStatus.php index b81b56764..45cde745f 100644 --- a/modules/monitoring/library/Monitoring/DataView/ServiceStatus.php +++ b/modules/monitoring/library/Monitoring/DataView/ServiceStatus.php @@ -101,6 +101,7 @@ class ServiceStatus extends DataView 'service_flap_detection_enabled', 'service_flap_detection_enabled_changed', 'service_modified_service_attributes', + 'service_host_name' ); } diff --git a/modules/monitoring/library/Monitoring/Object/Service.php b/modules/monitoring/library/Monitoring/Object/Service.php index ac6957eab..36a763101 100644 --- a/modules/monitoring/library/Monitoring/Object/Service.php +++ b/modules/monitoring/library/Monitoring/Object/Service.php @@ -191,7 +191,8 @@ class Service extends MonitoredObject 'service_flap_detection_enabled_changed', 'service_modified_service_attributes', 'service_process_performance_data', - 'service_percent_state_change' + 'service_percent_state_change', + 'service_host_name' )) ->where('host_name', $this->host->getName()) ->where('service_description', $this->service);