Do not display host- and servicegroups as boxes but as table instead

This commit is contained in:
Johannes Meyer 2014-11-19 11:52:23 +01:00
parent a2592f8d7b
commit c74f7531dc
5 changed files with 658 additions and 535 deletions

View File

@ -490,7 +490,16 @@ class Monitoring_ListController extends Controller
'services_critical_unhandled',
'services_warning_handled',
'services_warning_unhandled',
'services_pending'
'services_pending',
'services_ok_last_state_change',
'services_pending_last_state_change',
'services_warning_last_state_change_handled',
'services_critical_last_state_change_handled',
'services_unknown_last_state_change_handled',
'services_warning_last_state_change_unhandled',
'services_critical_last_state_change_unhandled',
'services_unknown_last_state_change_unhandled',
'services_total'
));
$this->filterQuery($query);
$this->view->servicegroups = $query->paginate();
@ -521,7 +530,16 @@ class Monitoring_ListController extends Controller
'services_critical_unhandled',
'services_warning_handled',
'services_warning_unhandled',
'services_pending'
'services_pending',
'services_ok_last_state_change',
'services_pending_last_state_change',
'services_warning_last_state_change_handled',
'services_critical_last_state_change_handled',
'services_unknown_last_state_change_handled',
'services_warning_last_state_change_unhandled',
'services_critical_last_state_change_unhandled',
'services_unknown_last_state_change_unhandled',
'services_total'
));
$this->filterQuery($query);
$this->view->hostgroups = $query->paginate();

View File

@ -1,266 +1,253 @@
<?php if (!$this->compact): ?>
<div class="controls">
<?= $this->tabs ?>
</div>
<?php endif ?>
<?php if ($this->compact): ?>
<div class="content">
<div class="boxview" data-base-target="_next">
<?php
if (count($hostgroups) === 0) {
echo mt('monitoring', 'No host groups matching the filter');
}
?>
<?php foreach($hostgroups as $h): ?>
<div class="box hostgroup">
<h2>
<a href="<?= $this->href('monitoring/list/services', array('hostgroup' => $h->hostgroup)); ?>">
<?= $h->hostgroup; ?>
</a>
</h2>
<div class="box contents">
<table>
<thead>
<tr>
<th><?= $this->translate('Hosts'); ?></th>
<th><?= $this->translate('Services'); ?></th>
</tr>
</thead>
<tbody>
<tr>
<td>
<?php if ($h->hosts_down_handled || $h->hosts_down_unhandled): ?>
<!-- Hosts DOWN -->
<div class="box entry state_down <?= $h->hosts_down_unhandled ? '' : 'handled'; ?>">
<?php if ($h->hosts_down_unhandled): ?>
<a href="<?= $this->href(
'monitoring/list/hosts',
array(
'host_state' => 1,
'host_unhandled' => 1,
'hostgroup' => $h->hostgroup
)
); ?>" title="<?= $this->translate('Hosts DOWN Unhandled') ?>">
<?= $h->hosts_down_unhandled; ?> <?= $this->translate('DOWN', 'icinga.state') ?>
</a>
<?php endif ?>
<?php if ($h->hosts_down_handled): ?>
<a href="<?= $this->href(
'monitoring/list/hosts',
array(
'host_state' => 1,
'host_handled' => 1,
'hostgroup' => $h->hostgroup
)
); ?>" title="<?= $this->translate('Hosts DOWN Handled') ?>">
<?= $h->hosts_down_handled . ' ' . ($h->hosts_down_unhandled ? $this->translate('Acknowledged') : $this->translate('DOWN', 'icinga.state')); ?>
</a>
<?php endif ?>
</div>
<!-- End of Hosts DOWN -->
<?php endif ?>
<?php if ($h->hosts_unreachable_handled || $h->hosts_unreachable_unhandled): ?>
<!-- Hosts UNREACHABLE -->
<div class="box entry state_unreachable <?= $h->hosts_unreachable_unhandled ? '' : 'handled'; ?>">
<?php if ($h->hosts_unreachable_unhandled): ?>
<a href="<?= $this->href(
'monitoring/list/hosts',
array(
'host_state' => 2,
'host_unhandled' => 1,
'hostgroup' => $h->hostgroup
)
); ?>" title="<?= $this->translate('Hosts UNREACHABLE Unhandled') ?>">
<?= $h->hosts_unreachable_unhandled; ?> <?= $this->translate('UNREACHABLE', 'icinga.state') ?>
</a>
<?php endif ?>
<?php if ($h->hosts_unreachable_handled): ?>
<a href="<?= $this->href(
'monitoring/list/hosts',
array(
'host_state' => 2,
'host_handled' => 1,
'hostgroup' => $h->hostgroup
)
); ?>" title="<?= $this->translate('Hosts UNREACHABLE Handled') ?>">
<?= $h->hosts_unreachable_handled . ' ' . ($h->hosts_unreachable_unhandled ? $this->translate('Acknowledged') : $this->translate('UNREACHABLE', 'icinga.state')) ?>
</a>
<?php endif ?>
</div>
<!-- End of Hosts UNREACHABLE -->
<?php endif ?>
<?php if ($h->hosts_up): ?>
<!-- Hosts UP -->
<div class="box entry state_up">
<a href="<?= $this->href(
'monitoring/list/hosts',
array(
'host_state' => 0,
'hostgroup' => $h->hostgroup
)
); ?>" title="<?= $this->translate('Hosts UP') ?>">
<?= $h->hosts_up; ?> <?= $this->translate('UP', 'icinga.state') ?>
</a>
</div>
<!-- End of Hosts UP -->
<?php endif ?>
<?php if ($h->hosts_pending): ?>
<!-- Hosts PENDING -->
<div class="box entry state_pending">
<a href="<?= $this->href(
'monitoring/list/hosts',
array(
'host_state' => 99,
'hostgroup' => $h->hostgroup
)
); ?>" title="<?= $this->translate('Hosts PENDING') ?>">
<?= $h->hosts_pending; ?> <?= $this->translate('PENDING', 'icinga.state') ?>
</a>
</div>
<!-- End of Hosts PENDING -->
<?php endif ?>
</td>
<td>
<?php if ($h->services_critical_handled || $h->services_critical_unhandled): ?>
<!-- Services CRITICAL -->
<div class="box entry state_critical <?= $h->services_critical_unhandled ? '' : 'handled'; ?>">
<?php if ($h->services_critical_unhandled): ?>
<a href="<?= $this->href(
'monitoring/list/services',
array(
'service_state' => 2,
'service_acknowledged' => 0,
'service_in_downtime' => 0,
'host_problem' => 0,
'hostgroup' => $h->hostgroup,
'sort' => 'service_severity'
)
); ?>" title="<?= $this->translate('Services CRITICAL Unhandled') ?>">
<?= $h->services_critical_unhandled; ?> <?= $this->translate('CRITICAL', 'icinga.state') ?>
</a>
<?php endif ?>
<?php if ($h->services_critical_handled): ?>
<a href="<?= $this->href(
'monitoring/list/services',
array(
'service_state' => 2,
'service_handled' => 1,
'hostgroup' => $h->hostgroup,
'sort' => 'service_severity'
)
); ?>" title="<?= $this->translate('Services CRITICAL Handled') ?>">
<?= $h->services_critical_handled . ' ' . ($h->services_critical_unhandled ? $this->translate('Acknowledged') : $this->translate('CRITICAL', 'icinga.state')); ?>
</a>
<?php endif ?>
</div>
<!-- End of Services CRITICAL -->
<?php endif ?>
<?php if ($h->services_warning_handled || $h->services_warning_unhandled): ?>
<!-- Services WARNING -->
<div class="box entry state_warning <?= $h->services_warning_unhandled ? '' : 'handled'; ?>">
<?php if ($h->services_warning_unhandled): ?>
<a href="<?= $this->href(
'monitoring/list/services',
array(
'service_state' => 1,
'service_acknowledged' => 0,
'service_in_downtime' => 0,
'host_problem' => 0,
'hostgroup' => $h->hostgroup,
'sort' => 'service_severity'
)
); ?>" title="<?= $this->translate('Services WARNING Unhandled') ?>">
<?= $h->services_warning_unhandled; ?> <?= $this->translate('WARNING', 'icinga.state') ?>
</a>
<?php endif ?>
<?php if ($h->services_warning_handled): ?>
<a href="<?= $this->href(
'monitoring/list/services',
array(
'service_state' => 1,
'service_handled' => 1,
'hostgroup' => $h->hostgroup,
'sort' => 'service_severity'
)
); ?>" title="<?= $this->translate('Services WARNING Handled') ?>">
<?= $h->services_warning_handled . ' ' . ($h->services_warning_unhandled ? $this->translate('Acknowledged') : $this->translate('WARNING', 'icinga.state')); ?>
</a>
<?php endif ?>
</div>
<!-- End of Services WARNING -->
<?php endif ?>
<?php if ($h->services_unknown_handled || $h->services_unknown_unhandled): ?>
<!-- Services UNKNOWN -->
<div class="box entry state_unknown <?= $h->services_unknown_unhandled ? '' : 'handled'; ?>">
<?php if ($h->services_unknown_unhandled): ?>
<a href="<?= $this->href(
'monitoring/list/services',
array(
'service_state' => 3,
'service_acknowledged' => 0,
'service_in_downtime' => 0,
'host_problem' => 0,
'hostgroup' => $h->hostgroup,
'sort' => 'service_severity'
)
); ?>" title="<?= $this->translate('Services UNKNOWN Unhandled') ?>">
<?= $h->services_unknown_unhandled; ?> <?= $this->translate('UNKNOWN', 'icinga.state') ?>
</a>
<?php endif ?>
<?php if ($h->services_unknown_handled): ?>
<a href="<?= $this->href(
'monitoring/list/services',
array(
'service_state' => 3,
'service_handled' => 1,
'hostgroup' => $h->hostgroup,
'sort' => 'service_severity'
)
); ?>" title="<?= $this->translate('Services UNKNOWN Handled') ?>">
<?= $h->services_unknown_handled . ' ' . ($h->services_unknown_unhandled ? $this->translate('Acknowledged') : $this->translate('UNKNOWN', 'icinga.state')); ?>
</a>
<?php endif ?>
</div>
<!-- End of Services UNKNOWN -->
<?php endif ?>
<?php if ($h->services_ok): ?>
<!-- Services OK -->
<div class="box entry state_ok">
<a href="<?= $this->href(
'monitoring/list/services',
array(
'service_state' => 0,
'hostgroup' => $h->hostgroup,
'sort' => 'service_severity'
)
); ?>" title="<?= $this->translate('Services OK') ?>">
<?= $h->services_ok; ?> <?= $this->translate('OK', 'icinga.state') ?>
</a>
</div>
<!-- End of Services OK -->
<?php endif ?>
<?php if ($h->services_pending): ?>
<!-- Services PENDING -->
<div class="box entry state_pending">
<a href="<?= $this->href(
'monitoring/list/services',
array(
'service_state' => 99,
'hostgroup' => $h->hostgroup,
'sort' => 'service_severity'
)
); ?>" title="<?= $this->translate('Services PENDING') ?>">
<?= $h->services_pending; ?> <?= $this->translate('PENDING', 'icinga.state') ?>
</a>
</div>
<!-- End of Services PENDING -->
<?php endif ?>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<?php endforeach ?>
</div>
<?php else: ?>
<div class="controls">
<?= $this->tabs ?>
<?= $this->widget('limiter')->setMaxLimit(count($hostgroups)); ?>
<?= $this->paginationControl($hostgroups, null, null, array('preserve' => $this->preserve)); ?>
</div>
<div class="content">
<?= $this->filterEditor; ?>
<?php endif ?>
<?php
if (count($hostgroups) === 0) {
echo $this->translate('No host groups matching the filter');
echo '</div>';
return;
}
?>
<table class="groupview" data-base-target="_next">
<thead>
<th style="text-align: left;"><?= $this->translate('Last Problem'); ?></th>
<th style="text-align: left;"><?= $this->translate('Host Group'); ?></th>
<th><?= $this->translate('Total Services'); ?></th>
<th colspan="5"><?= $this->translate('Service States'); ?></th>
</thead>
<tbody>
<?php foreach ($hostgroups as $h): ?>
<tr href="<?= $this->href('monitoring/list/services', array('hostgroup' => $h->hostgroup)); ?>">
<?php if ($h->services_critical_last_state_change_unhandled): ?>
<td class="state change critical">
<strong><?= $this->translate('CRITICAL'); ?></strong>
<br>
<?= $this->prefixedTimeSince($h->services_critical_last_state_change_unhandled); ?>
</td>
<?php elseif ($h->services_unknown_last_state_change_unhandled): ?>
<td class="state change unknown">
<strong><?= $this->translate('UNKNOWN'); ?></strong>
<br>
<?= $this->prefixedTimeSince($h->services_unknown_last_state_change_unhandled); ?>
</td>
<?php elseif ($h->services_warning_last_state_change_unhandled): ?>
<td class="state change warning">
<strong><?= $this->translate('WARNING'); ?></strong>
<br>
<?= $this->prefixedTimeSince($h->services_warning_last_state_change_unhandled); ?>
</td>
<?php elseif ($h->services_critical_last_state_change_handled): ?>
<td class="state change critical handled">
<strong><?= $this->translate('CRITICAL'); ?></strong>
<br>
<?= $this->prefixedTimeSince($h->services_critical_last_state_change_handled); ?>
</td>
<?php elseif ($h->services_unknown_last_state_change_handled): ?>
<td class="state change unknown handled">
<strong><?= $this->translate('UNKNOWN'); ?></strong>
<br>
<?= $this->prefixedTimeSince($h->services_unknown_last_state_change_handled); ?>
</td>
<?php elseif ($h->services_warning_last_state_change_handled): ?>
<td class="state change warning handled">
<strong><?= $this->translate('WARNING'); ?></strong>
<br>
<?= $this->prefixedTimeSince($h->services_warning_last_state_change_handled); ?>
</td>
<?php elseif ($h->services_ok_last_state_change): ?>
<td class="state change ok">
<strong><?= $this->translate('OK'); ?></strong>
<br>
<?= $this->prefixedTimeSince($h->services_ok_last_state_change); ?>
</td>
<?php else: ?>
<td class="state change pending">
<strong><?= $this->translate('PENDING'); ?></strong>
<br>
<?= $this->prefixedTimeSince($h->services_pending_last_state_change); ?>
</td>
<?php endif ?>
<td>
<a href="<?= $this->href('monitoring/list/services', array('hostgroup' => $h->hostgroup)); ?>">
<?= $h->hostgroup; ?>
</a>
</td>
<td class="services-total">
<?= $h->services_total; ?>
</td>
<td class="state">
<?php if ($h->services_ok): ?>
<span class="state ok">
<a href="<?= $this->href(
'monitoring/list/services',
array(
'service_state' => 0,
'hostgroup' => $h->hostgroup,
'sort' => 'service_severity'
)
); ?>" title="<?= $this->translate('Services OK'); ?>">
<?= $h->services_ok; ?>
</a>
</span>
<?php else: ?>
<span class="no-state">
-
</span>
<?php endif ?>
</td>
<td class="state">
<?php if ($h->services_critical_unhandled): ?>
<span class="state critical">
<a href="<?= $this->href(
'monitoring/list/services',
array(
'service_state' => 2,
'service_acknowledged' => 0,
'service_in_downtime' => 0,
'host_problem' => 0,
'hostgroup' => $h->hostgroup,
'sort' => 'service_severity'
)
); ?>" title="<?= $this->translate('Services CRITICAL Unhandled'); ?>">
<?= $h->services_critical_unhandled; ?>
</a>
<?php endif ?>
<?php if ($h->services_critical_handled): ?>
<span class="state critical handled">
<a href="<?= $this->href(
'monitoring/list/services',
array(
'service_state' => 2,
'service_handled' => 1,
'hostgroup' => $h->hostgroup,
'sort' => 'service_severity'
)
); ?>" title="<?= $this->translate('Services CRITICAL Handled'); ?>">
<?= $h->services_critical_handled; ?>
</a>
</span>
<?php endif ?>
<?php if ($h->services_critical_unhandled): ?>
</span>
<?php endif ?>
<?php if (! $h->services_critical_unhandled && !$h->services_critical_handled): ?>
<span class="no-state">
-
</span>
<?php endif ?>
</td>
<td class="state">
<?php if ($h->services_unknown_unhandled): ?>
<span class="state unknown">
<a href="<?= $this->href(
'monitoring/list/services',
array(
'service_state' => 3,
'service_acknowledged' => 0,
'service_in_downtime' => 0,
'host_problem' => 0,
'hostgroup' => $h->hostgroup,
'sort' => 'service_severity'
)
); ?>" title="<?= $this->translate('Services UNKNOWN Unhandled'); ?>">
<?= $h->services_unknown_unhandled; ?>
</a>
<?php endif ?>
<?php if ($h->services_unknown_handled): ?>
<span class="state unknown handled">
<a href="<?= $this->href(
'monitoring/list/services',
array(
'service_state' => 3,
'service_handled' => 1,
'hostgroup' => $h->hostgroup,
'sort' => 'service_severity'
)
); ?>" title="<?= $this->translate('Services UNKNOWN Handled'); ?>">
<?= $h->services_unknown_handled; ?>
</a>
</span>
<?php endif ?>
<?php if ($h->services_unknown_unhandled): ?>
</span>
<?php endif ?>
<?php if (! $h->services_unknown_unhandled && !$h->services_unknown_handled): ?>
<span class="no-state">
-
</span>
<?php endif ?>
</td>
<td class="state">
<?php if ($h->services_warning_unhandled): ?>
<span class="state warning">
<a href="<?= $this->href(
'monitoring/list/services',
array(
'service_state' => 1,
'service_acknowledged' => 0,
'service_in_downtime' => 0,
'host_problem' => 0,
'hostgroup' => $h->hostgroup,
'sort' => 'service_severity'
)
); ?>" title="<?= $this->translate('Services WARNING Unhandled'); ?>">
<?= $h->services_warning_unhandled; ?>
</a>
<?php endif ?>
<?php if ($h->services_warning_handled): ?>
<span class="state warning handled">
<a href="<?= $this->href(
'monitoring/list/services',
array(
'service_state' => 1,
'service_handled' => 1,
'hostgroup' => $h->hostgroup,
'sort' => 'service_severity'
)
); ?>" title="<?= $this->translate('Services WARNING Handled'); ?>">
<?= $h->services_warning_handled; ?>
</a>
</span>
<?php endif ?>
<?php if ($h->services_warning_unhandled): ?>
</span>
<?php endif ?>
<?php if (! $h->services_warning_unhandled && !$h->services_warning_handled): ?>
<span class="no-state">
-
</span>
<?php endif ?>
</td>
<td class="state">
<?php if ($h->services_pending): ?>
<span class="state pending">
<a href="<?= $this->href(
'monitoring/list/services',
array(
'service_state' => 99,
'hostgroup' => $h->hostgroup,
'sort' => 'service_severity'
)
); ?>" title="<?= $this->translate('Services PENDING'); ?>">
<?= $h->services_pending; ?>
</a>
</span>
<?php else: ?>
<span class="no-state">
-
</span>
<?php endif ?>
</td>
</tr>
<?php endforeach ?>
</tbody>
</table>
</div>

View File

@ -1,269 +1,253 @@
<?php if (!$this->compact): ?>
<div class="controls">
<?= $this->tabs ?>
</div>
<?php endif ?>
<?php if ($this->compact): ?>
<div class="content">
<div class="boxview" data-base-target="_next">
<?php
if (count($servicegroups) === 0) {
echo mt('monitoring', 'No service groups matching the filter');
}
?>
<?php foreach($servicegroups as $servicegroup): ?>
<div class="box servicegroup">
<h2>
<a href="<?= $this->href(
'monitoring/list/services',
array('servicegroup' => $servicegroup->servicegroup)
); ?>">
<?= $servicegroup->servicegroup; ?>
</a>
</h2>
<div class="box contents">
<table>
<thead>
<tr>
<th><?= $this->translate('Hosts'); ?></th>
<th><?= $this->translate('Services'); ?></th>
</tr>
</thead>
<tbody>
<tr>
<td>
<?php if ($servicegroup->hosts_down_handled || $servicegroup->hosts_down_unhandled): ?>
<!-- Hosts DOWN -->
<div class="box entry state_down <?= $servicegroup->hosts_down_unhandled ? '' : 'handled'; ?>">
<?php if ($servicegroup->hosts_down_unhandled): ?>
<a href="<?= $this->href(
'monitoring/list/hosts',
array(
'host_state' => 1,
'host_unhandled' => 1,
'servicegroup' => $servicegroup->servicegroup
)
); ?>" title="<?= $this->translate('Hosts DOWN Unhandled') ?>">
<?= $servicegroup->hosts_down_unhandled; ?> <?= $this->translate('DOWN', 'icinga.state') ?>
</a>
<?php endif ?>
<?php if ($servicegroup->hosts_down_handled): ?>
<a href="<?= $this->href(
'monitoring/list/hosts',
array(
'host_state' => 1,
'host_handled' => 1,
'servicegroup' => $servicegroup->servicegroup
)
); ?>" title="<?= $this->translate('Hosts DOWN Handled') ?>">
<?= $servicegroup->hosts_down_handled . ' ' . ($servicegroup->hosts_down_unhandled ? $this->translate('Acknowledged') : 'DOWN'); ?>
</a>
<?php endif ?>
</div>
<!-- End of Hosts DOWN -->
<?php endif ?>
<?php if ($servicegroup->hosts_unreachable_handled || $servicegroup->hosts_unreachable_unhandled): ?>
<!-- Hosts UNREACHABLE -->
<div class="box entry state_unreachable <?= $servicegroup->hosts_unreachable_unhandled ? '' : 'handled'; ?>">
<?php if ($servicegroup->hosts_unreachable_unhandled): ?>
<a href="<?= $this->href(
'monitoring/list/hosts',
array(
'host_state' => 2,
'host_unhandled' => 1,
'servicegroup' => $servicegroup->servicegroup
)
); ?>" title="<?= $this->translate('Hosts UNREACHABLE Unhandled') ?>">
<?= $servicegroup->hosts_unreachable_unhandled; ?> <?= $this->translate('UNREACHABLE', 'icinga.state') ?>
</a>
<?php endif ?>
<?php if ($servicegroup->hosts_unreachable_handled): ?>
<a href="<?= $this->href(
'monitoring/list/hosts',
array(
'host_state' => 2,
'host_handled' => 1,
'servicegroup' => $servicegroup->servicegroup
)
); ?>" title="<?= $this->translate('Hosts UNREACHABLE Handled') ?>">
<?= $servicegroup->hosts_unreachable_handled . ' ' . ($servicegroup->hosts_unreachable_unhandled ? $this->translate('Acknowledged') : 'UNREACHABLE'); ?>
</a>
<?php endif ?>
</div>
<!-- End of Hosts UNREACHABLE -->
<?php endif ?>
<?php if ($servicegroup->hosts_up): ?>
<!-- Hosts UP -->
<div class="box entry state_up">
<a href="<?= $this->href(
'monitoring/list/hosts',
array(
'host_state' => 0,
'servicegroup' => $servicegroup->servicegroup
)
); ?>" title="<?= $this->translate('Hosts UP') ?>">
<?= $servicegroup->hosts_up; ?> <?= $this->translate('UP', 'icinga.state') ?>
</a>
</div>
<!-- End of Hosts UP -->
<?php endif ?>
<?php if ($servicegroup->hosts_pending): ?>
<!-- Hosts PENDING -->
<div class="box entry state_pending">
<a href="<?= $this->href(
'monitoring/list/hosts',
array(
'host_state' => 99,
'servicegroup' => $servicegroup->servicegroup
)
); ?>" title="<?= $this->translate('Hosts PENDING') ?>">
<?= $servicegroup->hosts_pending; ?> <?= $this->translate('PENDING', 'icinga.state') ?>
</a>
</div>
<!-- End of Hosts PENDING -->
<?php endif ?>
</td>
<td>
<?php if ($servicegroup->services_critical_handled || $servicegroup->services_critical_unhandled): ?>
<!-- Services CRITICAL -->
<div class="box entry state_critical <?= $servicegroup->services_critical_unhandled ? '' : 'handled'; ?>">
<?php if ($servicegroup->services_critical_unhandled): ?>
<a href="<?= $this->href(
'monitoring/list/services',
array(
'service_state' => 2,
'service_acknowledged' => 0,
'service_in_downtime' => 0,
'host_problem' => 0,
'servicegroup' => $servicegroup->servicegroup,
'sort' => 'service_severity'
)
); ?>" title="<?= $this->translate('Services CRITICAL Unhandled') ?>">
<?= $servicegroup->services_critical_unhandled; ?> <?= $this->translate('CRITICAL', 'icinga.state') ?>
</a>
<?php endif ?>
<?php if ($servicegroup->services_critical_handled): ?>
<a href="<?= $this->href(
'monitoring/list/services',
array(
'service_state' => 2,
'service_handled' => 1,
'servicegroup' => $servicegroup->servicegroup,
'sort' => 'service_severity'
)
); ?>" title="<?= $this->translate('Services CRITICAL Handled') ?>">
<?= $servicegroup->services_critical_handled . ' ' . ($servicegroup->services_critical_unhandled ? $this->translate('Acknowledged') : 'CRITICAL'); ?>
</a>
<?php endif ?>
</div>
<!-- End of Services CRITICAL -->
<?php endif ?>
<?php if ($servicegroup->services_warning_handled || $servicegroup->services_warning_unhandled): ?>
<!-- Services WARNING -->
<div class="box entry state_warning <?= $servicegroup->services_warning_unhandled ? '' : 'handled'; ?>">
<?php if ($servicegroup->services_warning_unhandled): ?>
<a href="<?= $this->href(
'monitoring/list/services',
array(
'service_state' => 1,
'service_acknowledged' => 0,
'service_in_downtime' => 0,
'host_problem' => 0,
'servicegroup' => $servicegroup->servicegroup,
'sort' => 'service_severity'
)
); ?>" title="<?= $this->translate('Services WARNING Unhandled') ?>">
<?= $servicegroup->services_warning_unhandled; ?> <?= $this->translate('WARNING', 'icinga.state') ?>
</a>
<?php endif ?>
<?php if ($servicegroup->services_warning_handled): ?>
<a href="<?= $this->href(
'monitoring/list/services',
array(
'service_state' => 1,
'service_handled' => 1,
'servicegroup' => $servicegroup->servicegroup,
'sort' => 'service_severity'
)
); ?>" title="<?= $this->translate('Services WARNING Handled') ?>">
<?= $servicegroup->services_warning_handled . ' ' . ($servicegroup->services_warning_unhandled ? $this->translate('Acknowledged') : 'WARNING'); ?>
</a>
<?php endif ?>
</div>
<!-- End of Services WARNING -->
<?php endif ?>
<?php if ($servicegroup->services_unknown_handled || $servicegroup->services_unknown_unhandled): ?>
<!-- Services UNKNOWN -->
<div class="box entry state_unknown <?= $servicegroup->services_unknown_unhandled ? '' : 'handled'; ?>">
<?php if ($servicegroup->services_unknown_unhandled): ?>
<a href="<?= $this->href(
'monitoring/list/services',
array(
'service_state' => 3,
'service_acknowledged' => 0,
'service_in_downtime' => 0,
'host_problem' => 0,
'servicegroup' => $servicegroup->servicegroup,
'sort' => 'service_severity'
)
); ?>" title="<?= $this->translate('Services UNKNOWN Unhandled') ?>">
<?= $servicegroup->services_unknown_unhandled; ?> <?= $this->translate('UNKNOWN', 'icinga.state') ?>
</a>
<?php endif ?>
<?php if ($servicegroup->services_unknown_handled): ?>
<a href="<?= $this->href(
'monitoring/list/services',
array(
'service_state' => 3,
'service_handled' => 1,
'servicegroup' => $servicegroup->servicegroup,
'sort' => 'service_severity'
)
); ?>" title="<?= $this->translate('Services UNKNOWN Handled') ?>">
<?= $servicegroup->services_unknown_handled . ' ' . ($servicegroup->services_unknown_unhandled ? $this->translate('Acknowledged') : 'UNKNOWN'); ?>
</a>
<?php endif ?>
</div>
<!-- End of Services UNKNOWN -->
<?php endif ?>
<?php if ($servicegroup->services_ok): ?>
<!-- Services OK -->
<div class="box entry state_ok">
<a href="<?= $this->href(
'monitoring/list/services',
array(
'service_state' => 0,
'servicegroup' => $servicegroup->servicegroup,
'sort' => 'service_severity'
)
); ?>" title="<?= $this->translate('Services OK') ?>">
<?= $servicegroup->services_ok; ?> <?= $this->translate('OK', 'icinga.state') ?>
</a>
</div>
<!-- End of Services OK -->
<?php endif ?>
<?php if ($servicegroup->services_pending): ?>
<!-- Services PENDING -->
<div class="box entry state_pending">
<a href="<?= $this->href(
'monitoring/list/services',
array(
'service_state' => 99,
'servicegroup' => $servicegroup->servicegroup,
'sort' => 'service_severity'
)
); ?>" title="<?= $this->translate('Services PENDING') ?>">
<?= $servicegroup->services_pending; ?> <?= $this->translate('PENDING', 'icinga.state') ?>
</a>
</div>
<!-- End of Services PENDING -->
<?php endif ?>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<?php endforeach; ?>
</div>
<?php else: ?>
<div class="controls">
<?= $this->tabs ?>
<?= $this->widget('limiter')->setMaxLimit(count($servicegroups)); ?>
<?= $this->paginationControl($servicegroups, null, null, array('preserve' => $this->preserve)); ?>
</div>
<div class="content">
<?= $this->filterEditor; ?>
<?php endif ?>
<?php
if (count($servicegroups) === 0) {
echo $this->translate('No service groups matching the filter');
echo '</div>';
return;
}
?>
<table class="groupview" data-base-target="_next">
<thead>
<th style="text-align: left;"><?= $this->translate('Last Problem'); ?></th>
<th style="text-align: left;"><?= $this->translate('Service Group'); ?></th>
<th><?= $this->translate('Total Services'); ?></th>
<th colspan="5"><?= $this->translate('Service States'); ?></th>
</thead>
<tbody>
<?php foreach ($servicegroups as $s): ?>
<tr href="<?= $this->href('monitoring/list/services', array('servicegroup' => $s->servicegroup)); ?>">
<?php if ($s->services_critical_last_state_change_unhandled): ?>
<td class="state change critical">
<strong><?= $this->translate('CRITICAL'); ?></strong>
<br>
<?= $this->prefixedTimeSince($s->services_critical_last_state_change_unhandled); ?>
</td>
<?php elseif ($s->services_unknown_last_state_change_unhandled): ?>
<td class="state change unknown">
<strong><?= $this->translate('UNKNOWN'); ?></strong>
<br>
<?= $this->prefixedTimeSince($s->services_unknown_last_state_change_unhandled); ?>
</td>
<?php elseif ($s->services_warning_last_state_change_unhandled): ?>
<td class="state change warning">
<strong><?= $this->translate('WARNING'); ?></strong>
<br>
<?= $this->prefixedTimeSince($s->services_warning_last_state_change_unhandled); ?>
</td>
<?php elseif ($s->services_critical_last_state_change_handled): ?>
<td class="state change critical handled">
<strong><?= $this->translate('CRITICAL'); ?></strong>
<br>
<?= $this->prefixedTimeSince($s->services_critical_last_state_change_handled); ?>
</td>
<?php elseif ($s->services_unknown_last_state_change_handled): ?>
<td class="state change unknown handled">
<strong><?= $this->translate('UNKNOWN'); ?></strong>
<br>
<?= $this->prefixedTimeSince($s->services_unknown_last_state_change_handled); ?>
</td>
<?php elseif ($s->services_warning_last_state_change_handled): ?>
<td class="state change warning handled">
<strong><?= $this->translate('WARNING'); ?></strong>
<br>
<?= $this->prefixedTimeSince($s->services_warning_last_state_change_handled); ?>
</td>
<?php elseif ($s->services_ok_last_state_change): ?>
<td class="state change ok">
<strong><?= $this->translate('OK'); ?></strong>
<br>
<?= $this->prefixedTimeSince($s->services_ok_last_state_change); ?>
</td>
<?php else: ?>
<td class="state change pending">
<strong><?= $this->translate('PENDING'); ?></strong>
<br>
<?= $this->prefixedTimeSince($s->services_pending_last_state_change); ?>
</td>
<?php endif ?>
<td>
<a href="<?= $this->href('monitoring/list/services', array('servicegroup' => $s->servicegroup)); ?>">
<?= $s->servicegroup; ?>
</a>
</td>
<td class="services-total">
<?= $s->services_total; ?>
</td>
<td class="state">
<?php if ($s->services_ok): ?>
<span class="state ok">
<a href="<?= $this->href(
'monitoring/list/services',
array(
'service_state' => 0,
'servicegroup' => $s->servicegroup,
'sort' => 'service_severity'
)
); ?>" title="<?= $this->translate('Services OK'); ?>">
<?= $s->services_ok; ?>
</a>
</span>
<?php else: ?>
<span class="no-state">
-
</span>
<?php endif ?>
</td>
<td class="state">
<?php if ($s->services_critical_unhandled): ?>
<span class="state critical">
<a href="<?= $this->href(
'monitoring/list/services',
array(
'service_state' => 2,
'service_acknowledged' => 0,
'service_in_downtime' => 0,
'host_problem' => 0,
'servicegroup' => $s->servicegroup,
'sort' => 'service_severity'
)
); ?>" title="<?= $this->translate('Services CRITICAL Unhandled'); ?>">
<?= $s->services_critical_unhandled; ?>
</a>
<?php endif ?>
<?php if ($s->services_critical_handled): ?>
<span class="state critical handled">
<a href="<?= $this->href(
'monitoring/list/services',
array(
'service_state' => 2,
'service_handled' => 1,
'servicegroup' => $s->servicegroup,
'sort' => 'service_severity'
)
); ?>" title="<?= $this->translate('Services CRITICAL Handled'); ?>">
<?= $s->services_critical_handled; ?>
</a>
</span>
<?php endif ?>
<?php if ($s->services_critical_unhandled): ?>
</span>
<?php endif ?>
<?php if (! $s->services_critical_unhandled && !$s->services_critical_handled): ?>
<span class="no-state">
-
</span>
<?php endif ?>
</td>
<td class="state">
<?php if ($s->services_unknown_unhandled): ?>
<span class="state unknown">
<a href="<?= $this->href(
'monitoring/list/services',
array(
'service_state' => 3,
'service_acknowledged' => 0,
'service_in_downtime' => 0,
'host_problem' => 0,
'servicegroup' => $s->servicegroup,
'sort' => 'service_severity'
)
); ?>" title="<?= $this->translate('Services UNKNOWN Unhandled'); ?>">
<?= $s->services_unknown_unhandled; ?>
</a>
<?php endif ?>
<?php if ($s->services_unknown_handled): ?>
<span class="state unknown handled">
<a href="<?= $this->href(
'monitoring/list/services',
array(
'service_state' => 3,
'service_handled' => 1,
'servicegroup' => $s->servicegroup,
'sort' => 'service_severity'
)
); ?>" title="<?= $this->translate('Services UNKNOWN Handled'); ?>">
<?= $s->services_unknown_handled; ?>
</a>
</span>
<?php endif ?>
<?php if ($s->services_unknown_unhandled): ?>
</span>
<?php endif ?>
<?php if (! $s->services_unknown_unhandled && !$s->services_unknown_handled): ?>
<span class="no-state">
-
</span>
<?php endif ?>
</td>
<td class="state">
<?php if ($s->services_warning_unhandled): ?>
<span class="state warning">
<a href="<?= $this->href(
'monitoring/list/services',
array(
'service_state' => 1,
'service_acknowledged' => 0,
'service_in_downtime' => 0,
'host_problem' => 0,
'servicegroup' => $s->servicegroup,
'sort' => 'service_severity'
)
); ?>" title="<?= $this->translate('Services WARNING Unhandled'); ?>">
<?= $s->services_warning_unhandled; ?>
</a>
<?php endif ?>
<?php if ($s->services_warning_handled): ?>
<span class="state warning handled">
<a href="<?= $this->href(
'monitoring/list/services',
array(
'service_state' => 1,
'service_handled' => 1,
'servicegroup' => $s->servicegroup,
'sort' => 'service_severity'
)
); ?>" title="<?= $this->translate('Services WARNING Handled'); ?>">
<?= $s->services_warning_handled; ?>
</a>
</span>
<?php endif ?>
<?php if ($s->services_warning_unhandled): ?>
</span>
<?php endif ?>
<?php if (! $s->services_warning_unhandled && !$s->services_warning_handled): ?>
<span class="no-state">
-
</span>
<?php endif ?>
</td>
<td class="state">
<?php if ($s->services_pending): ?>
<span class="state pending">
<a href="<?= $this->href(
'monitoring/list/services',
array(
'service_state' => 99,
'servicegroup' => $s->servicegroup,
'sort' => 'service_severity'
)
); ?>" title="<?= $this->translate('Services PENDING'); ?>">
<?= $s->services_pending; ?>
</a>
</span>
<?php else: ?>
<span class="no-state">
-
</span>
<?php endif ?>
</td>
</tr>
<?php endforeach ?>
</tbody>
</table>
</div>

View File

@ -24,6 +24,7 @@ class GroupSummaryQuery extends IdoQuery
'hostgroup' => 'hostgroup'
),
'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)',
@ -35,6 +36,14 @@ class GroupSummaryQuery extends IdoQuery
'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_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)',
'services_warning_last_state_change_handled' => '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_handled' => '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_handled' => 'MAX(CASE WHEN object_type = \'service\' AND state = 3 AND acknowledged + in_downtime + host_state > 0 THEN state_change ELSE 0 END)',
'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'
)
);
@ -57,7 +66,8 @@ class GroupSummaryQuery extends IdoQuery
$columns + array(
'state' => 'host_state',
'acknowledged' => 'host_acknowledged',
'in_downtime' => 'host_in_downtime'
'in_downtime' => 'host_in_downtime',
'state_change' => 'host_last_state_change'
)
);
if (in_array('servicegroup', $this->desiredColumns)) {
@ -68,7 +78,8 @@ class GroupSummaryQuery extends IdoQuery
$columns + array(
'state' => 'service_state',
'acknowledged' => 'service_acknowledged',
'in_downtime' => 'service_in_downtime'
'in_downtime' => 'service_in_downtime',
'state_change' => 'service_last_state_change'
)
);

View File

@ -820,3 +820,126 @@ div.timeline {
}
/* End of monitoring timeline styles */
/* Monitoring groupsummary styles */
table.groupview {
width: 100%;
margin-top: 1em;
border-collapse: separate;
border-spacing: 0.1em;
thead th {
font-size: 0.9em;
}
tbody {
tr {
&:hover {
color: #333;
}
a {
color: #333;
text-decoration: none;
&:hover {
text-decoration: underline;
}
}
}
td.services-total {
width: 10%;
text-align: center;
}
td.state {
width: 10%;
color: white;
text-align: center;
&.change {
width: 10%;
white-space: nowrap;
padding: 0.3em 0.5em 0.3em 0.5em;
strong {
font-size: 0.8em;
}
span.timesince {
font-size: 0.8em;
}
}
&.ok {
color: #333;
border-left-style: solid;
border-left-width: 1.5em;
border-color: @colorOk;
}
&.pending {
color: #333;
border-left-style: solid;
border-left-width: 1.5em;
border-color: @colorPending;
}
&.warning {
background-color: @colorWarning;
&.handled {
background-color: inherit;
color: #333;
border-left-style: solid;
border-left-width: 1.5em;
border-color: @colorWarningHandled;
}
}
&.unknown {
background-color: @colorUnknown;
&.handled {
color: #333;
background-color: inherit;
border-left-style: solid;
border-left-width: 1.5em;
border-color: @colorUnknownHandled;
}
}
&.critical {
background-color: @colorCritical;
&.handled {
color: #333;
background-color: inherit;
border-left-style: solid;
border-left-width: 1.5em;
border-color: @colorCriticalHandled;
}
}
span {
&.no-state {
color: #333;
}
&.state {
&.handled {
margin-right: 2px;
}
a {
color: white;
}
}
}
}
}
}
/* End of monitoring groupsummary styles */