monitoring: Update content markup in host groups

This commit is contained in:
Eric Lippmann 2016-03-31 09:44:48 +02:00
parent 0551133291
commit 7bc17aee74
2 changed files with 260 additions and 258 deletions

View File

@ -510,7 +510,7 @@ class ListController extends Controller
'services_total' => $this->translate('Total Services') 'services_total' => $this->translate('Total Services')
), $hostGroups); ), $hostGroups);
$this->view->hostgroups = $hostGroups; $this->view->hostGroups = $hostGroups;
} }
public function eventhistoryAction() public function eventhistoryAction()

View File

@ -6,20 +6,20 @@ if (! $this->compact): ?>
<?= $this->tabs ?> <?= $this->tabs ?>
<?= $this->paginator ?> <?= $this->paginator ?>
<div class="sort-controls-container"> <div class="sort-controls-container">
<?= $this->sortBox ?>
<?= $this->limiter ?> <?= $this->limiter ?>
<?= $this->sortBox ?>
</div> </div>
<?= $this->filterEditor ?> <?= $this->filterEditor ?>
</div> </div>
<?php endif ?> <?php endif ?>
<div class="content"> <div class="content">
<?php if (! $hostgroups->hasResult()): ?> <?php /** @var \Icinga\Module\Monitoring\DataView\Hostgroup $hostGroups */ if (! $hostGroups->hasResult()): ?>
<p><?= $this->translate('No host groups found matching the filter.') ?></p> <p><?= $this->translate('No host groups found matching the filter.') ?></p>
</div> </div>
<?php return; endif ?> <?php return; endif ?>
<table class="table-row-selectable common-table" data-base-target="_next"> <table class="common-table table-row-selectable" data-base-target="_next">
<thead> <thead>
<tr> <tr>
<th></th> <th></th>
<th><?= $this->translate('Host Group') ?></th> <th><?= $this->translate('Host Group') ?></th>
@ -27,21 +27,21 @@ if (! $this->compact): ?>
<th></th> <th></th>
<th><?= $this->translate('Service States') ?></th> <th><?= $this->translate('Service States') ?></th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
<?php foreach ($hostgroups->peekAhead($this->compact) as $hostgroup): ?> <?php foreach ($hostGroups->peekAhead($this->compact) as $hostGroup): ?>
<tr> <tr>
<td class="count-col"> <td class="count-col">
<span class="badge"><?= $hostgroup->hosts_total ?></span> <span class="badge"><?= $hostGroup->hosts_total ?></span>
</td> </td>
<th> <th>
<?= $this->qlink( <?= $this->qlink(
$hostgroup->hostgroup_alias, $hostGroup->hostgroup_alias,
'monitoring/list/hosts', 'monitoring/list/hosts',
array('hostgroup_name' => $hostgroup->hostgroup_name), array('hostgroup_name' => $hostGroup->hostgroup_name),
array('title' => sprintf( array('title' => sprintf(
$this->translate('List all hosts in the group "%s"'), $this->translate('List all hosts in the group "%s"'),
$hostgroup->hostgroup_alias $hostGroup->hostgroup_alias
)) ))
) ?> ) ?>
</th> </th>
@ -53,93 +53,93 @@ if (! $this->compact): ?>
->setBaseFilter($this->filterEditor->getFilter()) ->setBaseFilter($this->filterEditor->getFilter())
->add( ->add(
StateBadges::STATE_UP, StateBadges::STATE_UP,
$hostgroup->hosts_up, $hostGroup->hosts_up,
array( array(
'host_state' => 0, 'host_state' => 0,
'hostgroup_name' => $hostgroup->hostgroup_name, 'hostgroup_name' => $hostGroup->hostgroup_name,
'sort' => 'host_severity' 'sort' => 'host_severity'
), ),
'List %u host that is currently in state UP in the host group "%s"', '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"', 'List %u hosts which are currently in state UP in the host group "%s"',
array($hostgroup->hosts_up, $hostgroup->hostgroup_alias) array($hostGroup->hosts_up, $hostGroup->hostgroup_alias)
) )
->add( ->add(
StateBadges::STATE_DOWN, StateBadges::STATE_DOWN,
$hostgroup->hosts_down_unhandled, $hostGroup->hosts_down_unhandled,
array( array(
'host_state' => 1, 'host_state' => 1,
'host_acknowledged' => 0, 'host_acknowledged' => 0,
'host_in_downtime' => 0, 'host_in_downtime' => 0,
'hostgroup_name' => $hostgroup->hostgroup_name, 'hostgroup_name' => $hostGroup->hostgroup_name,
'sort' => 'host_severity' 'sort' => 'host_severity'
), ),
'List %u host that is currently in state DOWN in the host group "%s"', '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"', 'List %u hosts which are currently in state DOWN in the host group "%s"',
array($hostgroup->hosts_down_unhandled, $hostgroup->hostgroup_alias) array($hostGroup->hosts_down_unhandled, $hostGroup->hostgroup_alias)
) )
->add( ->add(
StateBadges::STATE_DOWN_HANDLED, StateBadges::STATE_DOWN_HANDLED,
$hostgroup->hosts_down_handled, $hostGroup->hosts_down_handled,
array( array(
'host_state' => 1, 'host_state' => 1,
'host_handled' => 1, 'host_handled' => 1,
'hostgroup_name' => $hostgroup->hostgroup_name, 'hostgroup_name' => $hostGroup->hostgroup_name,
'sort' => 'host_severity' 'sort' => 'host_severity'
), ),
'List %u host that is currently in state DOWN (Acknowledged) in the host group "%s"', '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"', 'List %u hosts which are currently in state DOWN (Acknowledged) in the host group "%s"',
array($hostgroup->hosts_down_handled, $hostgroup->hostgroup_alias) array($hostGroup->hosts_down_handled, $hostGroup->hostgroup_alias)
) )
->add( ->add(
StateBadges::STATE_UNREACHABLE, StateBadges::STATE_UNREACHABLE,
$hostgroup->hosts_unreachable_unhandled, $hostGroup->hosts_unreachable_unhandled,
array( array(
'host_state' => 2, 'host_state' => 2,
'host_acknowledged' => 0, 'host_acknowledged' => 0,
'host_in_downtime' => 0, 'host_in_downtime' => 0,
'hostgroup_name' => $hostgroup->hostgroup_name, 'hostgroup_name' => $hostGroup->hostgroup_name,
'sort' => 'host_severity' 'sort' => 'host_severity'
), ),
'List %u host that is currently in state UNREACHABLE in the host group "%s"', '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"', 'List %u hosts which are currently in state UNREACHABLE in the host group "%s"',
array($hostgroup->hosts_unreachable_unhandled, $hostgroup->hostgroup_alias) array($hostGroup->hosts_unreachable_unhandled, $hostGroup->hostgroup_alias)
) )
->add( ->add(
StateBadges::STATE_UNREACHABLE_HANDLED, StateBadges::STATE_UNREACHABLE_HANDLED,
$hostgroup->hosts_unreachable_handled, $hostGroup->hosts_unreachable_handled,
array( array(
'host_state' => 2, 'host_state' => 2,
'host_handled' => 1, 'host_handled' => 1,
'hostgroup_name' => $hostgroup->hostgroup_name, 'hostgroup_name' => $hostGroup->hostgroup_name,
'sort' => 'host_severity' 'sort' => 'host_severity'
), ),
'List %u host that is currently in state UNREACHABLE (Acknowledged) in the host group "%s"', '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"', 'List %u hosts which are currently in state UNREACHABLE (Acknowledged) in the host group "%s"',
array($hostgroup->hosts_unreachable_handled, $hostgroup->hostgroup_alias) array($hostGroup->hosts_unreachable_handled, $hostGroup->hostgroup_alias)
) )
->add( ->add(
StateBadges::STATE_PENDING, StateBadges::STATE_PENDING,
$hostgroup->hosts_pending, $hostGroup->hosts_pending,
array( array(
'host_state' => 99, 'host_state' => 99,
'hostgroup_name' => $hostgroup->hostgroup_name, 'hostgroup_name' => $hostGroup->hostgroup_name,
'sort' => 'host_severity' 'sort' => 'host_severity'
), ),
'List %u host that is currently in state PENDING in the host group "%s"', '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"', 'List %u hosts which are currently in state PENDING in the host group "%s"',
array($hostgroup->hosts_pending, $hostgroup->hostgroup_alias) array($hostGroup->hosts_pending, $hostGroup->hostgroup_alias)
); );
echo $stateBadges->render(); echo $stateBadges->render();
?> ?>
</td> </td>
<td class="count-col"> <td class="count-col">
<?= $this->qlink( <?= $this->qlink(
$hostgroup->services_total, $hostGroup->services_total,
'monitoring/list/services', 'monitoring/list/services',
array('hostgroup_name' => $hostgroup->hostgroup_name), array('hostgroup_name' => $hostGroup->hostgroup_name),
array('title' => sprintf( array('title' => sprintf(
$this->translate('List all services of all hosts in host group "%s"'), $this->translate('List all services of all hosts in host group "%s"'),
$hostgroup->hostgroup_alias $hostGroup->hostgroup_alias
), 'class' => 'badge') ), 'class' => 'badge')
) ?> ) ?>
</td> </td>
@ -150,129 +150,131 @@ if (! $this->compact): ?>
->setUrl('monitoring/list/services') ->setUrl('monitoring/list/services')
->add( ->add(
StateBadges::STATE_OK, StateBadges::STATE_OK,
$hostgroup->services_ok, $hostGroup->services_ok,
array( array(
'service_state' => 0, 'service_state' => 0,
'hostgroup_name' => $hostgroup->hostgroup_name, 'hostgroup_name' => $hostGroup->hostgroup_name,
'sort' => 'service_severity' 'sort' => 'service_severity'
), ),
'List %u service that is currently in state OK on hosts in the host group "%s"', 'List %u service that is currently in state OK on hosts in the host group "%s"',
'List %u services which are currently in state OK on hosts in the host group "%s"', 'List %u services which are currently in state OK on hosts in the host group "%s"',
array($hostgroup->services_ok, $hostgroup->hostgroup_alias) array($hostGroup->services_ok, $hostGroup->hostgroup_alias)
) )
->add( ->add(
StateBadges::STATE_CRITICAL, StateBadges::STATE_CRITICAL,
$hostgroup->services_critical_unhandled, $hostGroup->services_critical_unhandled,
array( array(
'service_state' => 2, 'service_state' => 2,
'service_acknowledged' => 0, 'service_acknowledged' => 0,
'service_in_downtime' => 0, 'service_in_downtime' => 0,
'host_problem' => 0, 'host_problem' => 0,
'hostgroup_name' => $hostgroup->hostgroup_name, 'hostgroup_name' => $hostGroup->hostgroup_name,
'sort' => 'service_severity' 'sort' => 'service_severity'
), ),
'List %u service that is currently in state CRITICAL on hosts in the host group "%s"', 'List %u service that is currently in state CRITICAL on hosts in the host group "%s"',
'List %u services which are currently in state CRITICAL on hosts in the host group "%s"', 'List %u services which are currently in state CRITICAL on hosts in the host group "%s"',
array($hostgroup->services_critical_unhandled, $hostgroup->hostgroup_alias) array($hostGroup->services_critical_unhandled, $hostGroup->hostgroup_alias)
) )
->add( ->add(
StateBadges::STATE_CRITICAL_HANDLED, StateBadges::STATE_CRITICAL_HANDLED,
$hostgroup->services_critical_handled, $hostGroup->services_critical_handled,
array( array(
'service_state' => 2, 'service_state' => 2,
'service_handled' => 1, 'service_handled' => 1,
'hostgroup_name' => $hostgroup->hostgroup_name, 'hostgroup_name' => $hostGroup->hostgroup_name,
'sort' => 'service_severity' 'sort' => 'service_severity'
), ),
'List %u service that is currently in state CRITICAL (Acknowledged) on hosts in the host group "%s"', 'List %u service that is currently in state CRITICAL (Acknowledged) on hosts in the host group "%s"',
'List %u services which are currently in state CRITICAL (Acknowledged) on hosts in the host group "%s"', 'List %u services which are currently in state CRITICAL (Acknowledged) on hosts in the host group "%s"',
array($hostgroup->services_critical_unhandled, $hostgroup->hostgroup_alias) array($hostGroup->services_critical_unhandled, $hostGroup->hostgroup_alias)
) )
->add( ->add(
StateBadges::STATE_UNKNOWN, StateBadges::STATE_UNKNOWN,
$hostgroup->services_unknown_unhandled, $hostGroup->services_unknown_unhandled,
array( array(
'service_state' => 3, 'service_state' => 3,
'service_acknowledged' => 0, 'service_acknowledged' => 0,
'service_in_downtime' => 0, 'service_in_downtime' => 0,
'host_problem' => 0, 'host_problem' => 0,
'hostgroup_name' => $hostgroup->hostgroup_name, 'hostgroup_name' => $hostGroup->hostgroup_name,
'sort' => 'service_severity' 'sort' => 'service_severity'
), ),
'List %u service that is currently in state UNKNOWN on hosts in the host group "%s"', 'List %u service that is currently in state UNKNOWN on hosts in the host group "%s"',
'List %u services which are currently in state UNKNOWN on hosts in the host group "%s"', 'List %u services which are currently in state UNKNOWN on hosts in the host group "%s"',
array($hostgroup->services_unknown_unhandled, $hostgroup->hostgroup_alias) array($hostGroup->services_unknown_unhandled, $hostGroup->hostgroup_alias)
) )
->add( ->add(
StateBadges::STATE_UNKNOWN_HANDLED, StateBadges::STATE_UNKNOWN_HANDLED,
$hostgroup->services_unknown_handled, $hostGroup->services_unknown_handled,
array( array(
'service_state' => 3, 'service_state' => 3,
'service_handled' => 1, 'service_handled' => 1,
'hostgroup_name' => $hostgroup->hostgroup_name, 'hostgroup_name' => $hostGroup->hostgroup_name,
'sort' => 'service_severity' 'sort' => 'service_severity'
), ),
'List %u service that is currently in state UNKNOWN (Acknowledged) on hosts in the host group "%s"', 'List %u service that is currently in state UNKNOWN (Acknowledged) on hosts in the host group "%s"',
'List %u services which are currently in state UNKNOWN (Acknowledged) on hosts in the host group "%s"', 'List %u services which are currently in state UNKNOWN (Acknowledged) on hosts in the host group "%s"',
array($hostgroup->services_unknown_handled, $hostgroup->hostgroup_alias) array($hostGroup->services_unknown_handled, $hostGroup->hostgroup_alias)
) )
->add( ->add(
StateBadges::STATE_WARNING, StateBadges::STATE_WARNING,
$hostgroup->services_warning_unhandled, $hostGroup->services_warning_unhandled,
array( array(
'service_state' => 1, 'service_state' => 1,
'service_acknowledged' => 0, 'service_acknowledged' => 0,
'service_in_downtime' => 0, 'service_in_downtime' => 0,
'host_problem' => 0, 'host_problem' => 0,
'hostgroup_name' => $hostgroup->hostgroup_name, 'hostgroup_name' => $hostGroup->hostgroup_name,
'sort' => 'service_severity' 'sort' => 'service_severity'
), ),
'List %u service that is currently in state WARNING on hosts in the host group "%s"', 'List %u service that is currently in state WARNING on hosts in the host group "%s"',
'List %u services which are currently in state WARNING on hosts in the host group "%s"', 'List %u services which are currently in state WARNING on hosts in the host group "%s"',
array($hostgroup->services_warning_unhandled, $hostgroup->hostgroup_alias) array($hostGroup->services_warning_unhandled, $hostGroup->hostgroup_alias)
) )
->add( ->add(
StateBadges::STATE_WARNING_HANDLED, StateBadges::STATE_WARNING_HANDLED,
$hostgroup->services_warning_handled, $hostGroup->services_warning_handled,
array( array(
'service_state' => 1, 'service_state' => 1,
'service_handled' => 1, 'service_handled' => 1,
'hostgroup_name' => $hostgroup->hostgroup_name, 'hostgroup_name' => $hostGroup->hostgroup_name,
'sort' => 'service_severity' 'sort' => 'service_severity'
), ),
'List %u service that is currently in state WARNING (Acknowledged) on hosts in the host group "%s"', 'List %u service that is currently in state WARNING (Acknowledged) on hosts in the host group "%s"',
'List %u services which are currently in state WARNING (Acknowledged) on hosts in the host group "%s"', 'List %u services which are currently in state WARNING (Acknowledged) on hosts in the host group "%s"',
array($hostgroup->services_warning_handled, $hostgroup->hostgroup_alias) array($hostGroup->services_warning_handled, $hostGroup->hostgroup_alias)
) )
->add( ->add(
StateBadges::STATE_PENDING, StateBadges::STATE_PENDING,
$hostgroup->services_pending, $hostGroup->services_pending,
array( array(
'service_state' => 99, 'service_state' => 99,
'hostgroup_name' => $hostgroup->hostgroup_name, 'hostgroup_name' => $hostGroup->hostgroup_name,
'sort' => 'service_severity' 'sort' => 'service_severity'
), ),
'List %u service that is currently in state PENDING on hosts in the host group "%s"', 'List %u service that is currently in state PENDING on hosts in the host group "%s"',
'List %u services which are currently in state PENDING on hosts in the host group "%s"', 'List %u services which are currently in state PENDING on hosts in the host group "%s"',
array($hostgroup->services_pending, $hostgroup->hostgroup_alias) array($hostGroup->services_pending, $hostGroup->hostgroup_alias)
); );
echo $stateBadges->render(); echo $stateBadges->render();
?> ?>
</td> </td>
</tr> </tr>
<?php endforeach ?> <?php endforeach ?>
</tbody> </tbody>
</table> </table>
<?php if ($hostgroups->hasMore()): ?> <?php if ($hostGroups->hasMore()): ?>
<?= $this->qlink( <div class="action-links">
<?= $this->qlink(
$this->translate('Show More'), $this->translate('Show More'),
$this->url()->without(array('view', 'limit')), $this->url()->without(array('view', 'limit')),
null, null,
array( array(
'data-base-target' => '_next', 'class' => 'action-link',
'class' => 'pull-right action-link' 'data-base-target' => '_next'
) )
) ?> ) ?>
</div>
<?php endif ?> <?php endif ?>
</div> </div>