From 9c82a240830219ca2b74e8cc2d92a8f82b771215 Mon Sep 17 00:00:00 2001 From: Johannes Meyer Date: Mon, 29 Jun 2015 16:19:33 +0200 Subject: [PATCH] ServicestatussummaryQuery: Do not check a host's state twice I was sure that this is necessary and that the query involved does not handle this by itself, which it obviously does. I cannot find another query I might have mistakenly associated with it though... --- .../Ido/Query/ServicestatussummaryQuery.php | 27 +++++++++---------- 1 file changed, 13 insertions(+), 14 deletions(-) diff --git a/modules/monitoring/library/Monitoring/Backend/Ido/Query/ServicestatussummaryQuery.php b/modules/monitoring/library/Monitoring/Backend/Ido/Query/ServicestatussummaryQuery.php index 3215ca086..325203717 100644 --- a/modules/monitoring/library/Monitoring/Backend/Ido/Query/ServicestatussummaryQuery.php +++ b/modules/monitoring/library/Monitoring/Backend/Ido/Query/ServicestatussummaryQuery.php @@ -17,25 +17,25 @@ class ServicestatussummaryQuery extends IdoQuery protected $columnMap = array( 'servicestatussummary' => array( 'services_critical' => 'SUM(CASE WHEN state = 2 THEN 1 ELSE 0 END)', - 'services_critical_handled' => 'SUM(CASE WHEN state = 2 AND handled + host_problem > 0 THEN 1 ELSE 0 END)', -// 'services_critical_handled_last_state_change' => 'MAX(CASE WHEN state = 2 AND handled + host_problem > 0 THEN UNIX_TIMESTAMP(last_state_change) ELSE NULL END)', - 'services_critical_unhandled' => 'SUM(CASE WHEN state = 2 AND handled + host_problem = 0 THEN 1 ELSE 0 END)', -// 'services_critical_unhandled_last_state_change' => 'MAX(CASE WHEN state = 2 AND handled + host_problem = 0 THEN UNIX_TIMESTAMP(last_state_change) ELSE NULL END)', + 'services_critical_handled' => 'SUM(CASE WHEN state = 2 AND handled = 1 THEN 1 ELSE 0 END)', +// 'services_critical_handled_last_state_change' => 'MAX(CASE WHEN state = 2 AND handled = 1 THEN UNIX_TIMESTAMP(last_state_change) ELSE NULL END)', + 'services_critical_unhandled' => 'SUM(CASE WHEN state = 2 AND handled = 0 THEN 1 ELSE 0 END)', +// 'services_critical_unhandled_last_state_change' => 'MAX(CASE WHEN state = 2 AND handled = 0 THEN UNIX_TIMESTAMP(last_state_change) ELSE NULL END)', 'services_ok' => 'SUM(CASE WHEN state = 0 THEN 1 ELSE 0 END)', // 'services_ok_last_state_change' => 'MAX(CASE WHEN state = 0 THEN UNIX_TIMESTAMP(last_state_change) ELSE NULL END)', 'services_pending' => 'SUM(CASE WHEN state = 99 THEN 1 ELSE 0 END)', // 'services_pending_last_state_change' => 'MAX(CASE WHEN state = 99 THEN UNIX_TIMESTAMP(last_state_change) ELSE NULL END)', 'services_total' => 'SUM(1)', 'services_unknown' => 'SUM(CASE WHEN state = 3 THEN 1 ELSE 0 END)', - 'services_unknown_handled' => 'SUM(CASE WHEN state = 3 AND handled + host_problem > 0 THEN 1 ELSE 0 END)', -// 'services_unknown_handled_last_state_change' => 'MAX(CASE WHEN state = 3 AND handled + host_problem > 0 THEN UNIX_TIMESTAMP(last_state_change) ELSE NULL END)', - 'services_unknown_unhandled' => 'SUM(CASE WHEN state = 3 AND handled + host_problem = 0 THEN 1 ELSE 0 END)', -// 'services_unknown_unhandled_last_state_change' => 'MAX(CASE WHEN state = 3 AND handled + host_problem = 0 THEN UNIX_TIMESTAMP(last_state_change) ELSE NULL END)', + 'services_unknown_handled' => 'SUM(CASE WHEN state = 3 AND handled = 1 THEN 1 ELSE 0 END)', +// 'services_unknown_handled_last_state_change' => 'MAX(CASE WHEN state = 3 AND handled = 1 THEN UNIX_TIMESTAMP(last_state_change) ELSE NULL END)', + 'services_unknown_unhandled' => 'SUM(CASE WHEN state = 3 AND handled = 0 THEN 1 ELSE 0 END)', +// 'services_unknown_unhandled_last_state_change' => 'MAX(CASE WHEN state = 3 AND handled = 0 THEN UNIX_TIMESTAMP(last_state_change) ELSE NULL END)', 'services_warning' => 'SUM(CASE WHEN state = 1 THEN 1 ELSE 0 END)', - 'services_warning_handled' => 'SUM(CASE WHEN state = 1 AND handled + host_problem > 0 THEN 1 ELSE 0 END)', -// 'services_warning_handled_last_state_change' => 'MAX(CASE WHEN state = 1 AND handled + host_problem > 0 THEN UNIX_TIMESTAMP(last_state_change) ELSE NULL END)', - 'services_warning_unhandled' => 'SUM(CASE WHEN state = 1 AND handled + host_problem = 0 THEN 1 ELSE 0 END)', -// 'services_warning_unhandled_last_state_change' => 'MAX(CASE WHEN state = 1 AND handled + host_problem = 0 THEN UNIX_TIMESTAMP(last_state_change) ELSE NULL END)' + 'services_warning_handled' => 'SUM(CASE WHEN state = 1 AND handled = 1 THEN 1 ELSE 0 END)', +// 'services_warning_handled_last_state_change' => 'MAX(CASE WHEN state = 1 AND handled = 1 THEN UNIX_TIMESTAMP(last_state_change) ELSE NULL END)', + 'services_warning_unhandled' => 'SUM(CASE WHEN state = 1 AND handled = 0 THEN 1 ELSE 0 END)', +// 'services_warning_unhandled_last_state_change' => 'MAX(CASE WHEN state = 1 AND handled = 0 THEN UNIX_TIMESTAMP(last_state_change) ELSE NULL END)' ) ); @@ -66,8 +66,7 @@ class ServicestatussummaryQuery extends IdoQuery array( 'handled' => 'service_handled', 'state' => 'service_state', - 'state_change' => 'service_last_state_change', - 'host_problem' + 'state_change' => 'service_last_state_change' ) ); $this->select->from(