Merge pull request #3517 from Icinga/fix/cli-list-problems

Fix for CLI list --problems
This commit is contained in:
Eric Lippmann 2018-07-10 09:05:22 +02:00 committed by GitHub
commit 99d348d41f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 4 additions and 5 deletions

View File

@ -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());

View File

@ -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'

View File

@ -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'
)
);