monitoring/list/services: Make overdue/unreachable services better visible

refs #3212
This commit is contained in:
Johannes Meyer 2019-07-12 11:47:13 +02:00
parent 18b933679c
commit 5ead593fa7
3 changed files with 14 additions and 5 deletions

View File

@ -103,7 +103,8 @@ class HostController extends MonitoredObjectController
'service_passive_checks_enabled',
'current_check_attempt' => 'service_current_check_attempt',
'max_check_attempts' => 'service_max_check_attempts',
'service_check_command'
'service_check_command',
'service_next_update'
));
$this->applyRestriction('monitoring/filter/objects', $query);
$this->view->services = $query->where('host_name', $this->object->getName());

View File

@ -159,7 +159,8 @@ class ListController extends Controller
'service_notifications_enabled',
'service_active_checks_enabled',
'service_passive_checks_enabled',
'service_check_command'
'service_check_command',
'service_next_update'
), $this->addColumns()));
$this->applyRestriction('monitoring/filter/objects', $services);

View File

@ -1,4 +1,5 @@
<?php
use Icinga\Date\DateFormatter;
use Icinga\Module\Monitoring\Object\Host;
use Icinga\Module\Monitoring\Object\Service;
@ -38,10 +39,16 @@ if (! $this->compact): ?>
'host' => $service->host_name,
)
);
$serviceStateName = Service::getStateText($service->service_state); ?>
<tr>
$serviceStateName = Service::getStateText($service->service_state);
$serviceCheckOverdue = $service->service_next_update < time(); ?>
<tr<?= $serviceCheckOverdue ? ' class="state-outdated"' : '' ?>>
<td class="state-col state-<?= $serviceStateName ?><?= $service->service_handled ? ' handled' : '' ?>">
<div class="state-label"><?= Service::getStateText($service->service_state, true) ?></div>
<div class="state-label">
<?php if ($serviceCheckOverdue): ?>
<?= $this->icon('clock', sprintf($this->translate('Overdue %s'), DateFormatter::timeSince($service->service_next_update))) ?>
<?php endif ?>
<?= Service::getStateText($service->service_state, true) ?>
</div>
<?php if ((int) $service->service_state !== 99): ?>
<div class="state-meta">
<?= $this->timeSince($service->service_last_state_change, $this->compact) ?>