mirror of
https://github.com/Icinga/icingaweb2.git
synced 2025-07-20 20:34:25 +02:00
monitoring: Fix wrong unhandled service problems count in the hosts overview
The query was missing the is_active = 1 condition. I'll open an issue for the other affected queries. fixes #8013
This commit is contained in:
parent
d64ca3da99
commit
f9047e85c5
@ -518,31 +518,35 @@ class StatusQuery extends IdoQuery
|
|||||||
|
|
||||||
protected function joinServiceproblemsummary()
|
protected function joinServiceproblemsummary()
|
||||||
{
|
{
|
||||||
$sub = new Zend_Db_Expr('(SELECT'
|
$select = <<<'SQL'
|
||||||
. ' SUM(CASE WHEN (ss.problem_has_been_acknowledged + ss.scheduled_downtime_depth + COALESCE(hs.current_state, 0)) > 0 THEN 0 ELSE 1 END) AS unhandled_services_count,'
|
SELECT
|
||||||
. ' SUM(CASE WHEN (ss.problem_has_been_acknowledged + ss.scheduled_downtime_depth + COALESCE(hs.current_state, 0)) > 0 THEN 1 ELSE 0 END) AS handled_services_count,'
|
SUM(
|
||||||
. ' s.host_object_id FROM icinga_servicestatus ss'
|
CASE WHEN(ss.problem_has_been_acknowledged + ss.scheduled_downtime_depth + COALESCE(hs.current_state, 0)) > 0
|
||||||
. ' JOIN icinga_services s'
|
THEN 0
|
||||||
. ' ON s.service_object_id = ss.service_object_id'
|
ELSE 1
|
||||||
. ' AND ss.current_state > 0'
|
END
|
||||||
. ' JOIN icinga_hoststatus hs'
|
) AS unhandled_services_count,
|
||||||
. ' ON hs.host_object_id = s.host_object_id'
|
SUM(
|
||||||
. ' GROUP BY s.host_object_id)');
|
CASE WHEN (ss.problem_has_been_acknowledged + ss.scheduled_downtime_depth + COALESCE(hs.current_state, 0) ) > 0
|
||||||
|
THEN 1
|
||||||
|
ELSE 0
|
||||||
|
END
|
||||||
|
) AS handled_services_count,
|
||||||
|
s.host_object_id
|
||||||
|
FROM
|
||||||
|
icinga_servicestatus ss
|
||||||
|
JOIN icinga_objects o ON o.object_id = ss.service_object_id
|
||||||
|
JOIN icinga_services s ON s.service_object_id = o.object_id
|
||||||
|
JOIN icinga_hoststatus hs ON hs.host_object_id = s.host_object_id
|
||||||
|
WHERE
|
||||||
|
o.is_active = 1
|
||||||
|
AND o.objecttype_id = 2
|
||||||
|
AND ss.current_state > 0
|
||||||
|
GROUP BY
|
||||||
|
s.host_object_id
|
||||||
|
SQL;
|
||||||
$this->select->joinLeft(
|
$this->select->joinLeft(
|
||||||
array('sps' => $sub),
|
array('sps' => new Zend_Db_Expr('(' . $select . ')')),
|
||||||
'sps.host_object_id = hs.host_object_id',
|
|
||||||
array()
|
|
||||||
);
|
|
||||||
return;
|
|
||||||
|
|
||||||
$this->select->joinleft(
|
|
||||||
array ('sps' => new \Zend_Db_Expr(
|
|
||||||
'(SELECT COUNT(s.service_object_id) as unhandled_service_count, s.host_object_id as host_object_id '.
|
|
||||||
'FROM icinga_services s INNER JOIN icinga_servicestatus ss ON ss.current_state != 0 AND '.
|
|
||||||
'ss.problem_has_been_acknowledged = 0 AND ss.scheduled_downtime_depth = 0 AND '.
|
|
||||||
'ss.service_object_id = s.service_object_id '.
|
|
||||||
'GROUP BY s.host_object_id'.
|
|
||||||
')')),
|
|
||||||
'sps.host_object_id = hs.host_object_id',
|
'sps.host_object_id = hs.host_object_id',
|
||||||
array()
|
array()
|
||||||
);
|
);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user