Merge branch 'bugfix/use-display_name-for-groups-too-8266'

fixes #8266
This commit is contained in:
Eric Lippmann 2015-01-23 11:25:28 +01:00
commit 4be7f09a38
6 changed files with 37 additions and 23 deletions

View File

@ -499,6 +499,7 @@ class Monitoring_ListController extends Controller
$this->setAutorefreshInterval(12);
$query = $this->backend->select()->from('groupsummary', array(
'servicegroup',
'servicegroup_alias',
'hosts_up',
'hosts_unreachable_handled',
'hosts_unreachable_unhandled',
@ -546,6 +547,7 @@ class Monitoring_ListController extends Controller
$this->setAutorefreshInterval(12);
$query = $this->backend->select()->from('groupsummary', array(
'hostgroup',
'hostgroup_alias',
'hosts_up',
'hosts_unreachable_handled',
'hosts_unreachable_unhandled',

View File

@ -80,7 +80,7 @@
<?php endif ?>
<td class="groupname">
<a href="<?= $this->href('monitoring/list/hosts', array('hostgroup' => $h->hostgroup)); ?>">
<?= $h->hostgroup; ?>
<?= $this->escape($h->hostgroup_alias) ?>
</a>
</td>
<td class="total">

View File

@ -80,7 +80,7 @@
<?php endif ?>
<td class="groupname">
<a href="<?= $this->href('monitoring/list/services', array('servicegroup' => $s->servicegroup)); ?>">
<?= $s->servicegroup; ?>
<?= $this->translate($s->servicegroup_alias) ?>
</a>
</td>
<td class="total">

View File

@ -11,7 +11,7 @@ class GroupSummaryQuery extends IdoQuery
protected $useSubqueryCount = true;
protected $columnMap = array(
'hoststatussummary' => array(
'hoststatussummary' => array(
'hosts_up' => 'SUM(CASE WHEN object_type = \'host\' AND state = 0 THEN 1 ELSE 0 END)',
'hosts_unreachable' => 'SUM(CASE WHEN object_type = \'host\' AND state = 2 THEN 1 ELSE 0 END)',
'hosts_unreachable_handled' => 'SUM(CASE WHEN object_type = \'host\' AND state = 2 AND acknowledged + in_downtime != 0 THEN 1 ELSE 0 END)',
@ -20,21 +20,22 @@ 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)',
'services_ok' => 'SUM(CASE WHEN object_type = \'service\' AND state = 0 THEN 1 ELSE 0 END)',
'services_pending' => 'SUM(CASE WHEN object_type = \'service\' AND state = 99 THEN 1 ELSE 0 END)',
'services_warning' => 'SUM(CASE WHEN object_type = \'service\' AND state = 1 THEN 1 ELSE 0 END)',
'services_warning_handled' => 'SUM(CASE WHEN object_type = \'service\' AND state = 1 AND acknowledged + in_downtime + host_state > 0 THEN 1 ELSE 0 END)',
'services_critical' => 'SUM(CASE WHEN object_type = \'service\' AND state = 2 THEN 1 ELSE 0 END)',
'services_critical_handled' => 'SUM(CASE WHEN object_type = \'service\' AND state = 2 AND acknowledged + in_downtime + host_state > 0 THEN 1 ELSE 0 END)',
'services_unknown' => 'SUM(CASE WHEN object_type = \'service\' AND state = 3 THEN 1 ELSE 0 END)',
'services_unknown_handled' => 'SUM(CASE WHEN object_type = \'service\' AND state = 3 AND acknowledged + in_downtime + host_state > 0 THEN 1 ELSE 0 END)',
'services_warning_unhandled' => 'SUM(CASE WHEN object_type = \'service\' AND state = 1 AND acknowledged + in_downtime + host_state = 0 THEN 1 ELSE 0 END)',
'services_critical_unhandled' => 'SUM(CASE WHEN object_type = \'service\' AND state = 2 AND acknowledged + in_downtime + host_state = 0 THEN 1 ELSE 0 END)',
'services_unknown_unhandled' => 'SUM(CASE WHEN object_type = \'service\' AND state = 3 AND acknowledged + in_downtime + host_state = 0 THEN 1 ELSE 0 END)',
'servicestatussummary' => array(
'services_total' => 'SUM(CASE WHEN object_type = \'service\' THEN 1 ELSE 0 END)',
'services_ok' => 'SUM(CASE WHEN object_type = \'service\' AND state = 0 THEN 1 ELSE 0 END)',
'services_pending' => 'SUM(CASE WHEN object_type = \'service\' AND state = 99 THEN 1 ELSE 0 END)',
'services_warning' => 'SUM(CASE WHEN object_type = \'service\' AND state = 1 THEN 1 ELSE 0 END)',
'services_warning_handled' => 'SUM(CASE WHEN object_type = \'service\' AND state = 1 AND acknowledged + in_downtime + host_state > 0 THEN 1 ELSE 0 END)',
'services_critical' => 'SUM(CASE WHEN object_type = \'service\' AND state = 2 THEN 1 ELSE 0 END)',
'services_critical_handled' => 'SUM(CASE WHEN object_type = \'service\' AND state = 2 AND acknowledged + in_downtime + host_state > 0 THEN 1 ELSE 0 END)',
'services_unknown' => 'SUM(CASE WHEN object_type = \'service\' AND state = 3 THEN 1 ELSE 0 END)',
'services_unknown_handled' => 'SUM(CASE WHEN object_type = \'service\' AND state = 3 AND acknowledged + in_downtime + host_state > 0 THEN 1 ELSE 0 END)',
'services_warning_unhandled' => 'SUM(CASE WHEN object_type = \'service\' AND state = 1 AND acknowledged + in_downtime + host_state = 0 THEN 1 ELSE 0 END)',
'services_critical_unhandled' => 'SUM(CASE WHEN object_type = \'service\' AND state = 2 AND acknowledged + in_downtime + host_state = 0 THEN 1 ELSE 0 END)',
'services_unknown_unhandled' => 'SUM(CASE WHEN object_type = \'service\' AND state = 3 AND acknowledged + in_downtime + host_state = 0 THEN 1 ELSE 0 END)',
'services_severity' => 'MAX(CASE WHEN object_type = \'service\' THEN severity ELSE 0 END)',
'services_ok_last_state_change' => 'MAX(CASE WHEN object_type = \'service\' AND state = 0 THEN state_change ELSE 0 END)',
'services_pending_last_state_change' => 'MAX(CASE WHEN object_type = \'service\' AND state = 99 THEN state_change 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(

View File

@ -84,10 +84,12 @@ class HoststatusQuery extends IdoQuery
END'
),
'hostgroups' => array(
'hostgroup' => 'hgo.name1 COLLATE latin1_general_ci',
'hostgroup' => 'hgo.name1 COLLATE latin1_general_ci',
'hostgroup_alias' => 'hg.alias'
),
'servicegroups' => array(
'servicegroup' => 'sgo.name1 COLLATE latin1_general_ci',
'servicegroup' => 'sgo.name1 COLLATE latin1_general_ci',
'servicegroup_alias' => 'sg.alias'
),
'contactgroups' => array(
'contactgroup' => 'contactgroup',

View File

@ -160,10 +160,12 @@ class StatusQuery extends IdoQuery
END'
),
'hostgroups' => array(
'hostgroup' => 'hgo.name1',
'hostgroup' => 'hgo.name1 COLLATE latin1_general_ci',
'hostgroup_alias' => 'hg.alias'
),
'servicegroups' => array(
'servicegroup' => 'sgo.name1',
'servicegroup' => 'sgo.name1 COLLATE latin1_general_ci',
'servicegroup_alias' => 'sg.alias'
),
'services' => array(
'service_host_name' => 'so.name1 COLLATE latin1_general_ci',