mirror of
https://github.com/Icinga/icingaweb2.git
synced 2025-07-23 13:54:26 +02:00
Consider is_active column when fetching host and service statistics
fixes #6157
This commit is contained in:
parent
0fc2604af3
commit
0d92efc1b0
@ -29,7 +29,7 @@
|
|||||||
|
|
||||||
namespace Icinga\Module\Monitoring\Backend\Ido\Query;
|
namespace Icinga\Module\Monitoring\Backend\Ido\Query;
|
||||||
|
|
||||||
use \Zend_Db_Select;
|
use Zend_Db_Select;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Query check summaries out of database
|
* Query check summaries out of database
|
||||||
@ -50,43 +50,49 @@ class RuntimesummaryQuery extends IdoQuery
|
|||||||
|
|
||||||
protected function joinBaseTables()
|
protected function joinBaseTables()
|
||||||
{
|
{
|
||||||
$p = $this->prefix;
|
$hosts = $this->db->select()->from(
|
||||||
|
array('ho' => $this->prefix . 'objects'),
|
||||||
|
array()
|
||||||
|
)->join(
|
||||||
|
array('hs' => $this->prefix . 'hoststatus'),
|
||||||
|
'ho.object_id = hs.host_object_id AND ho.is_active = 1 AND ho.objecttype_id = 1',
|
||||||
|
array()
|
||||||
|
)->columns(
|
||||||
|
array(
|
||||||
|
'check_type' => 'CASE '
|
||||||
|
. 'WHEN hs.active_checks_enabled = 0 AND hs.passive_checks_enabled = 1 THEN \'passive\' '
|
||||||
|
. 'WHEN hs.active_checks_enabled = 1 THEN \'active\' '
|
||||||
|
. 'END',
|
||||||
|
'active_checks_enabled' => 'hs.active_checks_enabled',
|
||||||
|
'passive_checks_enabled' => 'hs.passive_checks_enabled',
|
||||||
|
'execution_time' => 'SUM(hs.execution_time)',
|
||||||
|
'latency' => 'SUM(hs.latency)',
|
||||||
|
'object_count' => 'COUNT(*)',
|
||||||
|
'object_type' => "('host')"
|
||||||
|
)
|
||||||
|
)->group('check_type')->group('active_checks_enabled')->group('passive_checks_enabled');
|
||||||
|
|
||||||
$hostColumns = array(
|
$services = $this->db->select()->from(
|
||||||
'check_type' => 'CASE '
|
array('so' => $this->prefix . 'objects'),
|
||||||
. 'WHEN ' . $p
|
array()
|
||||||
. 'hoststatus.active_checks_enabled = 0 AND '
|
)->join(
|
||||||
. $p . 'hoststatus.passive_checks_enabled = 1 '
|
array('ss' => $this->prefix . 'servicestatus'),
|
||||||
. 'THEN \'passive\' '
|
'so.object_id = ss.service_object_id AND so.is_active = 1 AND so.objecttype_id = 2',
|
||||||
. 'WHEN ' . $p . 'hoststatus.active_checks_enabled = 1 THEN \'active\' END',
|
array()
|
||||||
'active_checks_enabled' => 'active_checks_enabled',
|
)->columns(
|
||||||
'passive_checks_enabled' => 'passive_checks_enabled',
|
array(
|
||||||
'execution_time' => 'SUM(execution_time)',
|
'check_type' => 'CASE '
|
||||||
'latency' => 'SUM(latency)',
|
. 'WHEN ss.active_checks_enabled = 0 AND ss.passive_checks_enabled = 1 THEN \'passive\' '
|
||||||
'object_count' => 'COUNT(*)',
|
. 'WHEN ss.active_checks_enabled = 1 THEN \'active\' '
|
||||||
'object_type' => "('host')"
|
. 'END',
|
||||||
);
|
'active_checks_enabled' => 'ss.active_checks_enabled',
|
||||||
|
'passive_checks_enabled' => 'ss.passive_checks_enabled',
|
||||||
$serviceColumns = array(
|
'execution_time' => 'SUM(ss.execution_time)',
|
||||||
'check_type' => 'CASE '
|
'latency' => 'SUM(ss.latency)',
|
||||||
. 'WHEN ' . $p
|
'object_count' => 'COUNT(*)',
|
||||||
. 'servicestatus.active_checks_enabled = 0 AND ' . $p
|
'object_type' => "('service')"
|
||||||
. 'servicestatus.passive_checks_enabled = 1 '
|
)
|
||||||
. 'THEN \'passive\' '
|
)->group('check_type')->group('active_checks_enabled')->group('passive_checks_enabled');
|
||||||
. 'WHEN ' . $p . 'servicestatus.active_checks_enabled = 1 THEN \'active\' END',
|
|
||||||
'active_checks_enabled' => 'active_checks_enabled',
|
|
||||||
'passive_checks_enabled' => 'passive_checks_enabled',
|
|
||||||
'execution_time' => 'SUM(execution_time)',
|
|
||||||
'latency' => 'SUM(latency)',
|
|
||||||
'object_count' => 'COUNT(*)',
|
|
||||||
'object_type' => "('service')"
|
|
||||||
);
|
|
||||||
|
|
||||||
$hosts = $this->db->select()->from($this->prefix . 'hoststatus', $hostColumns)
|
|
||||||
->group('check_type')->group('active_checks_enabled')->group('passive_checks_enabled');
|
|
||||||
|
|
||||||
$services = $this->db->select()->from($this->prefix . 'servicestatus', $serviceColumns)
|
|
||||||
->group('check_type')->group('active_checks_enabled')->group('passive_checks_enabled');
|
|
||||||
|
|
||||||
$union = $this->db->select()->union(
|
$union = $this->db->select()->union(
|
||||||
array('s' => $services, 'h' => $hosts),
|
array('s' => $services, 'h' => $hosts),
|
||||||
|
Loading…
x
Reference in New Issue
Block a user