Merge pull request #3860 from Icinga/feature/make-overdue-checks-better-visible-3212

Make overdue/unreachable checks better visible
This commit is contained in:
Johannes Meyer 2019-07-29 09:28:33 +02:00 committed by GitHub
commit b5f7e84246
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 36 additions and 15 deletions

View File

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

View File

@ -77,7 +77,8 @@ class ListController extends Controller
'host_notifications_enabled', 'host_notifications_enabled',
'host_active_checks_enabled', 'host_active_checks_enabled',
'host_passive_checks_enabled', 'host_passive_checks_enabled',
'host_check_command' 'host_check_command',
'host_next_update'
), $this->addColumns())); ), $this->addColumns()));
$this->applyRestriction('monitoring/filter/objects', $hosts); $this->applyRestriction('monitoring/filter/objects', $hosts);
@ -158,7 +159,8 @@ class ListController extends Controller
'service_notifications_enabled', 'service_notifications_enabled',
'service_active_checks_enabled', 'service_active_checks_enabled',
'service_passive_checks_enabled', 'service_passive_checks_enabled',
'service_check_command' 'service_check_command',
'service_next_update'
), $this->addColumns())); ), $this->addColumns()));
$this->applyRestriction('monitoring/filter/objects', $services); $this->applyRestriction('monitoring/filter/objects', $services);

View File

@ -1,4 +1,5 @@
<?php <?php
use Icinga\Date\DateFormatter;
use Icinga\Module\Monitoring\Object\Host; use Icinga\Module\Monitoring\Object\Host;
if (! $this->compact): ?> if (! $this->compact): ?>
@ -25,10 +26,16 @@ if (! $this->compact): ?>
<tbody> <tbody>
<?php foreach($hosts->peekAhead($this->compact) as $host): <?php foreach($hosts->peekAhead($this->compact) as $host):
$hostStateName = Host::getStateText($host->host_state); $hostStateName = Host::getStateText($host->host_state);
$hostLink = $this->href('monitoring/host/show', array('host' => $host->host_name)); ?> $hostLink = $this->href('monitoring/host/show', array('host' => $host->host_name));
<tr> $hostCheckOverdue = $host->host_next_update < time();?>
<tr<?= $hostCheckOverdue ? ' class="state-outdated"' : '' ?>>
<td class="state-col state-<?= $hostStateName ?><?= $host->host_handled ? ' handled' : '' ?>"> <td class="state-col state-<?= $hostStateName ?><?= $host->host_handled ? ' handled' : '' ?>">
<div class="state-label"><?= Host::getStateText($host->host_state, true) ?></div> <div class="state-label">
<?php if ($hostCheckOverdue): ?>
<?= $this->icon('clock', sprintf($this->translate('Overdue %s'), DateFormatter::timeSince($host->host_next_update))) ?>
<?php endif ?>
<?= Host::getStateText($host->host_state, true) ?>
</div>
<?php if ((int) $host->host_state !== 99): ?> <?php if ((int) $host->host_state !== 99): ?>
<div class="state-meta"> <div class="state-meta">
<?= $this->timeSince($host->host_last_state_change, $this->compact) ?> <?= $this->timeSince($host->host_last_state_change, $this->compact) ?>

View File

@ -1,4 +1,5 @@
<?php <?php
use Icinga\Date\DateFormatter;
use Icinga\Module\Monitoring\Object\Host; use Icinga\Module\Monitoring\Object\Host;
use Icinga\Module\Monitoring\Object\Service; use Icinga\Module\Monitoring\Object\Service;
@ -38,10 +39,16 @@ if (! $this->compact): ?>
'host' => $service->host_name, 'host' => $service->host_name,
) )
); );
$serviceStateName = Service::getStateText($service->service_state); ?> $serviceStateName = Service::getStateText($service->service_state);
<tr> $serviceCheckOverdue = $service->service_next_update < time(); ?>
<tr<?= $serviceCheckOverdue ? ' class="state-outdated"' : '' ?>>
<td class="state-col state-<?= $serviceStateName ?><?= $service->service_handled ? ' handled' : '' ?>"> <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): ?> <?php if ((int) $service->service_state !== 99): ?>
<div class="state-meta"> <div class="state-meta">
<?= $this->timeSince($service->service_last_state_change, $this->compact) ?> <?= $this->timeSince($service->service_last_state_change, $this->compact) ?>

View File

@ -98,14 +98,14 @@ class HoststatusQuery extends IdoQuery
NULL NULL
ELSE ELSE
UNIX_TIMESTAMP(hs.last_check) UNIX_TIMESTAMP(hs.last_check)
+ CASE WHEN + (CASE WHEN
COALESCE(hs.current_state, 0) > 0 AND hs.state_type = 0 COALESCE(hs.current_state, 0) > 0 AND hs.state_type = 0
THEN THEN
hs.retry_check_interval hs.retry_check_interval
ELSE ELSE
hs.normal_check_interval hs.normal_check_interval
END * 60 * 2 END * 60
+ CEIL(hs.execution_time) + CEIL(hs.execution_time) + CEIL(hs.latency)) * 2
END', END',
'host_no_more_notifications' => 'hs.no_more_notifications', 'host_no_more_notifications' => 'hs.no_more_notifications',
'host_normal_check_interval' => 'hs.normal_check_interval', 'host_normal_check_interval' => 'hs.normal_check_interval',

View File

@ -204,14 +204,14 @@ class ServicestatusQuery extends IdoQuery
NULL NULL
ELSE ELSE
UNIX_TIMESTAMP(ss.last_check) UNIX_TIMESTAMP(ss.last_check)
+ CASE WHEN + (CASE WHEN
COALESCE(ss.current_state, 0) > 0 AND ss.state_type = 0 COALESCE(ss.current_state, 0) > 0 AND ss.state_type = 0
THEN THEN
ss.retry_check_interval ss.retry_check_interval
ELSE ELSE
ss.normal_check_interval ss.normal_check_interval
END * 60 * 2 END * 60
+ CEIL(ss.execution_time) + CEIL(ss.execution_time) + CEIL(ss.latency)) * 2
END', END',
'service_no_more_notifications' => 'ss.no_more_notifications', 'service_no_more_notifications' => 'ss.no_more_notifications',
'service_normal_check_interval' => 'ss.normal_check_interval', 'service_normal_check_interval' => 'ss.normal_check_interval',

View File

@ -240,6 +240,10 @@
background-color: @tr-hover-color; background-color: @tr-hover-color;
cursor: pointer; cursor: pointer;
} }
tr[href].state-outdated:not(:hover):not(.active) td:not(.state-col) {
opacity: 0.7;
}
} }
// Event history // Event history