/
services.phtml
123 lines (111 loc) · 4.8 KB
/
services.phtml
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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
<?php
use Icinga\Module\Monitoring\Object\Host;
use Icinga\Module\Monitoring\Object\Service;
$selfUrl = 'monitoring/list/services';
if (! $this->compact): ?>
<div class="controls">
<?= $this->tabs; ?>
<div class="dontprint">
<?= $this->render('list/components/selectioninfo.phtml'); ?>
<?= $this->render('list/components/servicesummary.phtml'); ?>
</div>
<?= $this->sortBox; ?>
<?= $this->limiter; ?>
<?= $this->paginator; ?>
<?= $this->filterEditor; ?>
</div>
<?php endif ?>
<div class="content">
<?php
if (count($services) === 0) {
echo $this->translate('No services found matching the filter') . '</div>';
return;
}
?>
<table data-base-target="_next"
class="action multiselect <?php if ($this->compact): ?> compact<?php endif ?>" style="table-layout: auto;"
data-icinga-multiselect-url="<?= $this->href("monitoring/services/show") ?>"
data-icinga-multiselect-data="service_description,host_name">
<tbody>
<?php foreach ($services as $service):
$serviceLink = $this->href(
'monitoring/service/show',
array(
'host' => $service->host_name,
'service' => $service->service_description
)
);
$hostLink = $this->href(
'monitoring/show/host',
array(
'host' => $service->host_name,
)
);
$serviceStateName = Service::getStateText($service->service_state);
?>
<tr class="state <?= $serviceStateName ?><?= $service->service_handled ? ' handled' : '' ?>">
<td class="state">
<strong><?= Service::getStateText($service->service_state, true); ?></strong><br />
<?php if (!$this->compact): ?><?= $this->prefixedTimeSince($service->service_last_state_change); ?><?php else: ?><?= $this->timeSince($service->service_last_state_change); ?><?php endif ?>
<?php if ($service->service_state > 0 && (int) $service->service_state_type === 0): ?>
<br />
<strong>Soft <?= $service->service_attempt ?></strong>
<?php endif ?>
</td>
<td>
<div class="sparkline-box"><?= $this->perfdata($service->service_perfdata, true, 8) ?> </div>
<?php if (!$service->service_handled && $service->service_state > 0): ?>
<?= $this->icon('attention-alt', $this->translate('Unhandled')) ?>
<?php endif ?>
<?php if ($service->service_acknowledged && !$service->service_in_downtime): ?>
<?= $this->icon('ok', $this->translate('Acknowledged') . (
$service->service_last_ack ? ': ' . $service->service_last_ack : ''
)) ?>
<?php endif ?>
<?php if ($service->service_is_flapping): ?>
<?= $this->icon('flapping', $this->translate('Flapping')) ?>
<?php endif ?>
<?php if (!$service->service_notifications_enabled): ?>
<?= $this->icon('bell-off-empty', $this->translate('Notifications Disabled')) ?>
<?php endif ?>
<?php if ($service->service_in_downtime): ?>
<?= $this->icon('plug', $this->translate('In Downtime')) ?>
<?php endif ?>
<?php if (isset($service->service_last_comment) && $service->service_last_comment !== null): ?>
<?= $this->icon('comment', $this->translate('Last Comment: ') . $service->service_last_comment) ?>
<?php endif ?>
<?php if (!$service->service_active_checks_enabled): ?>
<?php if (!$service->service_passive_checks_enabled): ?>
<?= $this->icon('eye-off', $this->translate('Active And Passive Checks Disabled')) ?>
<?php else: ?>
<?= $this->icon('eye-off', $this->translate('Active Checks Disabled')) ?>
<?php endif ?>
<?php endif ?>
<?php if ($service->service_icon_image && ! preg_match('/[\'"]/', $service->service_icon_image)): ?>
<?= $this->icon($this->resolveMacros($service->service_icon_image, $service)) ?>
<?php endif ?>
<?= $this->qlink(
$service->service_display_name,
$serviceLink,
null,
array('title' => sprintf(
$this->translate('Show detailed information for service %s on host %s'),
$service->service_display_name,
$service->host_display_name
))
); ?><?php if ($this->showHost): ?> on <?= $this->qlink(
$service->host_display_name . ($service->host_state != 0 ? ' (' . Host::getStateText($service->host_state, true) . ')' : ''),
$hostLink,
null,
array('title' => sprintf($this->translate('Show detailed information for host %s'), $service->host_display_name))
); ?><?php endif ?><br>
<p class="pluginoutput"><?= $this->escape($this->ellipsis($service->service_output, 10000)); ?></p>
</td>
<?php foreach($this->extraColumns as $col): ?>
<td><?= $this->escape($service->$col) ?></td>
<?php endforeach ?>
</tr>
<?php endforeach ?>
</tbody>
</table>
</div>