summaryrefslogtreecommitdiffstats
path: root/modules/monitoring/application/views/scripts/show/components/checkstatistics.phtml
blob: e37e30ac6cbdef487301c72f3e015685c163f742 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
<?php
/** @var \Icinga\Module\Monitoring\Object\MonitoredObject $object */
$activeChecksEnabled = (bool) $object->active_checks_enabled;
?>

<tr>
    <th><?= $activeChecksEnabled ? $this->translate('Last check') : $this->translate('Last update') ?></th>
    <td data-base-target="_self">
<?php if ((int) $object->state !== 99): ?>
        <?= $this->timeAgo($object->last_check) ?>
    <?php if ($object->next_update < time()): ?>
        <?= $this->icon('circle', $this->translate('Check result is late'), array('class' => 'icon-stateful state-critical')) ?>
    <?php endif ?>
<?php endif ?>
    <?php if (isset($checkNowForm)) { // Form is unset if the current user lacks the respective permission
        echo $checkNowForm;
    } ?>
    </td>
</tr>

<tr>
    <th><?= $activeChecksEnabled ? $this->translate('Next check') : $this->translate('Next update') ?></th>
    <td>
    <?php if ((int) $object->state !== 99) {
        if ($activeChecksEnabled) {
            echo $this->timeUntil($object->next_check);
        } else {
            echo sprintf($this->translate('expected %s'), $this->timeUntil($object->next_update));
        }
    } ?>
    <?php if ($activeChecksEnabled && $this->hasPermission('monitoring/command/schedule-check')) {
        if ($object->getType() === $object::TYPE_SERVICE) {
            echo $this->qlink(
                $this->translate('Reschedule'),
                'monitoring/service/reschedule-check',
                array('host' => $object->getHost()->getName(), 'service' => $object->getName()),
                array(
                    'class'             => 'action-link',
                    'data-base-target'  => '_self',
                    'icon'              => 'calendar-empty',
                    'title'             => $this->translate(
                        'Schedule the next active check at a different time than the current one'
                    )
                )
            );
        } else {
            echo $this->qlink(
                $this->translate('Reschedule'),
                'monitoring/host/reschedule-check',
                array('host' => $object->getName()),
                array(
                    'class'             => 'action-link',
                    'data-base-target'  => '_self',
                    'icon'              => 'calendar-empty',
                    'title'             => $this->translate(
                        'Schedule the next active check at a different time than the current one'
                    )
                )
            );
        }
    } ?>
    </td>
</tr>

<tr>
    <th><?= $this->translate('Check attempts') ?></th>
    <td>
        <?= $object->attempt ?>
        (<?= (int) $object->state_type === 0 ? $this->translate('soft state') : $this->translate('hard state') ?>)
    </td>
</tr>

<?php if ($object->check_execution_time): ?>
<tr>
    <th><?= $this->translate('Check execution time') ?></th>
    <td><?= round((float) $object->check_execution_time, 3) ?>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 ?>