icingaweb2/modules/monitoring/application/views/scripts/show/components/checkstatistics.phtml

80 lines
2.8 KiB
PHTML

<?php
/** @type \Icinga\Module\Monitoring\Object\MonitoredObject $object */
if ($object->getType() === $object::TYPE_HOST) {
$isService = false;
$checkAttempts = $object->host_current_check_attempt . '/' . $object->host_max_check_attempts;
$stateType = (int) $object->host_state_type;
} else {
$isService = true;
$checkAttempts = $object->service_attempt;
$stateType = (int) $object->service_state_type;
}
?>
<tr>
<th><?= $this->translate('Last check') ?></th>
<td data-base-target="_self">
<?php if (isset($checkNowForm)) { // Form is unset if the current user lacks the respective permission
echo $checkNowForm;
} ?>
<?= $this->timeSince($object->last_check) ?>
</td>
</tr>
<tr>
<th><?= $this->translate('Next check') ?></th>
<td>
<?php if ($this->hasPermission('monitoring/command/schedule-check')) {
if ($isService) {
echo $this->qlink(
$this->icon('reschedule') . ' ' . $this->translate('Reschedule'),
'monitoring/service/reschedule-check',
array('host' => $object->getHost()->getName(), 'service' => $object->getName()),
array(
'data-base-target' => '_self',
'title' => $this->translate(
'Schedule the next active check at a different time than the current one'
)
),
false
);
} else {
echo $this->qlink(
$this->icon('reschedule') . ' ' . $this->translate('Reschedule'),
'monitoring/host/reschedule-check',
array('host' => $object->getName()),
array(
'data-base-target' => '_self',
'title' => $this->translate(
'Schedule the next active check at a different time than the current one'
)
),
false
);
}
} ?> <?= $this->timeUntil($object->next_check) ?>
</td>
</tr>
<tr>
<th><?= $this->translate('Check attempts') ?></th>
<?php if ($stateType === 0): ?>
<td><?= $checkAttempts ?> (<?= $this->translate('soft state') ?>)</td>
<?php else: ?>
<td><?= $checkAttempts ?> (<?= $this->translate('hard state') ?>)</td>
<?php endif; ?>
</tr>
<?php if ($object->check_execution_time): ?>
<tr>
<th><?= $this->translate('Check execution time') ?></th>
<td><?= $object->check_execution_time ?>s</td>
</tr>
<?php endif ?>
<?php if ($object->check_latency): ?>
<tr>
<th><?= $this->translate('Check latency') ?></th>
<td><?= $object->check_latency ?>s</td>
</tr>
<?php endif ?>