From b3fcbbee97b4f1a5fe47ec1852dd2d3e7a98b834 Mon Sep 17 00:00:00 2001 From: Eric Lippmann Date: Mon, 9 Jul 2018 16:08:02 +0200 Subject: [PATCH 1/2] Revert "Fix icingacli monitoring list --problems" This reverts commit 855e7f71208cb6d69b2190a7709182518178d382. --- modules/monitoring/application/clicommands/ListCommand.php | 3 --- 1 file changed, 3 deletions(-) diff --git a/modules/monitoring/application/clicommands/ListCommand.php b/modules/monitoring/application/clicommands/ListCommand.php index de0df668a..5cf804a77 100644 --- a/modules/monitoring/application/clicommands/ListCommand.php +++ b/modules/monitoring/application/clicommands/ListCommand.php @@ -56,9 +56,6 @@ class ListCommand extends Command $query->limit($limit, $this->params->shift('offset')); } foreach ($this->params->getParams() as $col => $filter) { - if (strtolower($col) === 'problems') { - $col = 'service_problem'; - } $query->where($col, $filter); } // $query->applyFilters($this->params->getParams()); From ea722484b00a6fd4f08fd77afb4597989414766d Mon Sep 17 00:00:00 2001 From: Eric Lippmann Date: Mon, 9 Jul 2018 16:10:07 +0200 Subject: [PATCH 2/2] Introduce 'problems' columns for CLI usage refs #3512 --- .../library/Monitoring/Backend/Ido/Query/HoststatusQuery.php | 3 ++- .../Monitoring/Backend/Ido/Query/ServicestatusQuery.php | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/modules/monitoring/library/Monitoring/Backend/Ido/Query/HoststatusQuery.php b/modules/monitoring/library/Monitoring/Backend/Ido/Query/HoststatusQuery.php index f21c2c792..09c4f624f 100644 --- a/modules/monitoring/library/Monitoring/Backend/Ido/Query/HoststatusQuery.php +++ b/modules/monitoring/library/Monitoring/Backend/Ido/Query/HoststatusQuery.php @@ -142,7 +142,8 @@ class HoststatusQuery extends IdoQuery 'host_state' => 'CASE WHEN hs.has_been_checked = 0 OR hs.has_been_checked IS NULL THEN 99 ELSE hs.current_state END', 'host_state_type' => 'hs.state_type', 'host_status_update_time' => 'hs.status_update_time', - 'host_unhandled' => 'CASE WHEN (hs.problem_has_been_acknowledged + hs.scheduled_downtime_depth) = 0 THEN 1 ELSE 0 END' + 'host_unhandled' => 'CASE WHEN (hs.problem_has_been_acknowledged + hs.scheduled_downtime_depth) = 0 THEN 1 ELSE 0 END', + 'problems' => 'CASE WHEN COALESCE(hs.current_state, 0) = 0 THEN 0 ELSE 1 END' ), 'instances' => array( 'instance_name' => 'i.instance_name' diff --git a/modules/monitoring/library/Monitoring/Backend/Ido/Query/ServicestatusQuery.php b/modules/monitoring/library/Monitoring/Backend/Ido/Query/ServicestatusQuery.php index c98cf7a63..5e002ed0e 100644 --- a/modules/monitoring/library/Monitoring/Backend/Ido/Query/ServicestatusQuery.php +++ b/modules/monitoring/library/Monitoring/Backend/Ido/Query/ServicestatusQuery.php @@ -262,7 +262,8 @@ class ServicestatusQuery extends IdoQuery 'service_state' => 'CASE WHEN ss.has_been_checked = 0 OR ss.has_been_checked IS NULL THEN 99 ELSE ss.current_state END', 'service_state_type' => 'ss.state_type', 'service_status_update_time' => 'ss.status_update_time', - 'service_unhandled' => 'CASE WHEN (ss.problem_has_been_acknowledged + ss.scheduled_downtime_depth + COALESCE(hs.current_state, 0)) = 0 THEN 1 ELSE 0 END' + 'service_unhandled' => 'CASE WHEN (ss.problem_has_been_acknowledged + ss.scheduled_downtime_depth + COALESCE(hs.current_state, 0)) = 0 THEN 1 ELSE 0 END', + 'problems' => 'CASE WHEN COALESCE(ss.current_state, 0) = 0 THEN 0 ELSE 1 END' ) );