Merge branch 'feature/list-number-of-hosts-in-host-groups-8054'

resolves #8054
This commit is contained in:
Eric Lippmann 2015-05-19 15:10:20 +02:00
commit 0a8c9ad195
4 changed files with 172 additions and 0 deletions

View File

@ -535,6 +535,7 @@ class Monitoring_ListController extends Controller
'hosts_unreachable_last_state_change_handled',
'hosts_down_last_state_change_unhandled',
'hosts_unreachable_last_state_change_unhandled',
'hosts_total',
'services_ok',
'services_unknown_handled',
'services_unknown_unhandled',

View File

@ -22,6 +22,8 @@ if (count($hostgroups) === 0) {
<thead>
<th><?= $this->translate('Last Problem'); ?></th>
<th><?= $this->translate('Host Group'); ?></th>
<th><?= $this->translate('Total Hosts'); ?></th>
<th><?= $this->translate('Host States'); ?></th>
<th><?= $this->translate('Total Services'); ?></th>
<th><?= $this->translate('Service States'); ?></th>
</thead>
@ -68,6 +70,173 @@ if (count($hostgroups) === 0) {
array('title' => sprintf($this->translate('List all hosts in the group "%s"'), $h->hostgroup_alias))
); ?>
</td>
<td class="total">
<?= $this->qlink(
$h->hosts_total,
'monitoring/list/hosts',
array('hostgroup_name' => $h->hostgroup_name),
array('title' => sprintf(
$this->translate('List all hosts in host group "%s"'),
$h->hostgroup_alias
))
); ?>
</td>
<td>
<?php if ($h->hosts_up): ?>
<span class="state ok">
<?= $this->qlink(
$h->hosts_up,
'monitoring/list/hosts',
array(
'host_state' => 0,
'hostgroup_name' => $h->hostgroup_name,
'sort' => 'host_severity'
),
array(
'title' => sprintf(
$this->translatePlural(
'List %u host that is currently in state UP in the host group "%s"',
'List %u hosts which are currently in state UP in the host group "%s"',
$h->hosts_up
),
$h->hosts_up,
$h->hostgroup_alias
)
)
); ?>
</span>
<?php endif ?>
<?php if ($h->hosts_down_unhandled): ?>
<span class="state critical">
<?= $this->qlink(
$h->hosts_down_unhandled,
'monitoring/list/hosts',
array(
'host_state' => 1,
'host_acknowledged' => 0,
'host_in_downtime' => 0,
'hostgroup_name' => $h->hostgroup_name,
'sort' => 'host_severity'
),
array(
'title' => sprintf(
$this->translatePlural(
'List %u host that is currently in state DOWN in the host group "%s"',
'List %u hosts which are currently in state DOWN in the host group "%s"',
$h->hosts_down_unhandled
),
$h->hosts_down_unhandled,
$h->hostgroup_alias
)
)
); ?>
<?php endif ?>
<?php if ($h->hosts_down_handled): ?>
<span class="state critical handled">
<?= $this->qlink(
$h->hosts_down_handled,
'monitoring/list/hosts',
array(
'host_state' => 1,
'host_handled' => 1,
'hostgroup_name' => $h->hostgroup_name,
'sort' => 'host_severity'
),
array(
'title' => sprintf(
$this->translatePlural(
'List %u host that is currently in state DOWN (Acknowledged) in the host group "%s"',
'List %u hosts which are currently in state DOWN (Acknowledged) in the host group "%s"',
$h->hosts_down_handled
),
$h->hosts_down_handled,
$h->hostgroup_alias
)
)
); ?>
</span>
<?php endif ?>
<?php if ($h->hosts_down_unhandled): ?>
</span>
<?php endif ?>
<?php if ($h->hosts_unreachable_unhandled): ?>
<span class="state unknown">
<?= $this->qlink(
$h->hosts_unreachable_unhandled,
'monitoring/list/hosts',
array(
'host_state' => 2,
'host_acknowledged' => 0,
'host_in_downtime' => 0,
'hostgroup_name' => $h->hostgroup_name,
'sort' => 'host_severity'
),
array(
'title' => sprintf(
$this->translatePlural(
'List %u host that is currently in state UNREACHABLE in the host group "%s"',
'List %u hosts which are currently in state UNREACHABLE in the host group "%s"',
$h->hosts_unreachable_unhandled
),
$h->hosts_unreachable_unhandled,
$h->hostgroup_alias
)
)
); ?>
<?php endif ?>
<?php if ($h->hosts_unreachable_handled): ?>
<span class="state unknown handled">
<?= $this->qlink(
$h->hosts_unreachable_handled,
'monitoring/list/hosts',
array(
'host_state' => 2,
'host_handled' => 1,
'hostgroup_name' => $h->hostgroup_name,
'sort' => 'host_severity'
),
array(
'title' => sprintf(
$this->translatePlural(
'List %u host that is currently in state UNREACHABLE (Acknowledged) in the host group "%s"',
'List %u hosts which are currently in state UNREACHABLE (Acknowledged) in the host group "%s"',
$h->hosts_unreachable_handled
),
$h->hosts_unreachable_handled,
$h->hostgroup_alias
)
)
); ?>
</span>
<?php endif ?>
<?php if ($h->hosts_unreachable_unhandled): ?>
</span>
<?php endif ?>
<?php if ($h->hosts_pending): ?>
<span class="state pending">
<?= $this->qlink(
$h->hosts_pending,
'monitoring/list/hosts',
array(
'host_state' => 99,
'hostgroup_name' => $h->hostgroup_name,
'sort' => 'host_severity'
),
array(
'title' => sprintf(
$this->translatePlural(
'List %u host that is currently in state PENDING in the host group "%s"',
'List %u hosts which are currently in state PENDING in the host group "%s"',
$h->hosts_pending
),
$h->hosts_pending,
$h->hostgroup_alias
)
)
); ?>
</span>
<?php endif ?>
</td>
<td class="total">
<?= $this->qlink(
$h->services_total,

View File

@ -11,6 +11,7 @@ class GroupSummaryQuery extends IdoQuery
protected $columnMap = array(
'hoststatussummary' => array(
'hosts_total' => 'SUM(CASE WHEN object_type = \'host\' THEN 1 ELSE 0 END)',
'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)',

View File

@ -17,6 +17,7 @@ class Groupsummary extends DataView
'servicegroup_alias',
'hostgroup_name',
'hostgroup_alias',
'hosts_total',
'hosts_up',
'hosts_unreachable',
'hosts_unreachable_handled',