monitoring: Support selecting host group and service group alias in the GroupsummaryQuery
refs #8266
This commit is contained in:
parent
74a0c1e274
commit
30eed015ba
|
@ -20,7 +20,8 @@ class GroupSummaryQuery extends IdoQuery
|
|||
'hosts_down_handled' => 'SUM(CASE WHEN object_type = \'host\' AND state = 1 AND acknowledged + in_downtime != 0 THEN 1 ELSE 0 END)',
|
||||
'hosts_down_unhandled' => 'SUM(CASE WHEN object_type = \'host\' AND state = 1 AND acknowledged + in_downtime = 0 THEN 1 ELSE 0 END)',
|
||||
'hosts_pending' => 'SUM(CASE WHEN object_type = \'host\' AND state = 99 THEN 1 ELSE 0 END)',
|
||||
'hostgroup' => 'hostgroup'
|
||||
'hostgroup' => 'hostgroup',
|
||||
'hostgroup_alias' => 'hostgroup_alias'
|
||||
),
|
||||
'servicestatussummary' => array(
|
||||
'services_total' => 'SUM(CASE WHEN object_type = \'service\' THEN 1 ELSE 0 END)',
|
||||
|
@ -44,7 +45,8 @@ class GroupSummaryQuery extends IdoQuery
|
|||
'services_warning_last_state_change_unhandled' => 'MAX(CASE WHEN object_type = \'service\' AND state = 1 AND acknowledged + in_downtime + host_state = 0 THEN state_change ELSE 0 END)',
|
||||
'services_critical_last_state_change_unhandled' => 'MAX(CASE WHEN object_type = \'service\' AND state = 2 AND acknowledged + in_downtime + host_state = 0 THEN state_change ELSE 0 END)',
|
||||
'services_unknown_last_state_change_unhandled' => 'MAX(CASE WHEN object_type = \'service\' AND state = 3 AND acknowledged + in_downtime + host_state = 0 THEN state_change ELSE 0 END)',
|
||||
'servicegroup' => 'servicegroup'
|
||||
'servicegroup' => 'servicegroup',
|
||||
'servicegroup_alias' => 'servicegroup_alias'
|
||||
)
|
||||
);
|
||||
|
||||
|
@ -52,7 +54,7 @@ class GroupSummaryQuery extends IdoQuery
|
|||
{
|
||||
$columns = array(
|
||||
'object_type',
|
||||
'host_state',
|
||||
'host_state'
|
||||
);
|
||||
|
||||
// Prepend group column since we'll use columns index 0 later for grouping
|
||||
|
@ -61,6 +63,12 @@ class GroupSummaryQuery extends IdoQuery
|
|||
} else {
|
||||
array_unshift($columns, 'hostgroup');
|
||||
}
|
||||
if (in_array('hostgroup_alias', $this->desiredColumns)) {
|
||||
$columns[] = 'hostgroup_alias';
|
||||
}
|
||||
if (in_array('servicegroup_alias', $this->desiredColumns)) {
|
||||
$columns[] = 'servicegroup_alias';
|
||||
}
|
||||
$hosts = $this->createSubQuery(
|
||||
'Hoststatus',
|
||||
$columns + array(
|
||||
|
|
Loading…
Reference in New Issue