/
hosts.phtml
134 lines (122 loc) · 4.54 KB
/
hosts.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
124
125
126
127
128
129
130
131
132
133
134
<?php
use Icinga\Module\Monitoring\Object\Host;
if (! $this->compact): ?>
<div class="controls">
<?= $this->tabs; ?>
<div class="dontprint">
<?= $this->render('list/components/selectioninfo.phtml'); ?>
<?= $this->render('list/components/hostssummary.phtml'); ?>
</div>
<?= $this->sortBox; ?>
<?= $this->limiter; ?>
<?= $this->paginator; ?>
<?= $this->selectionToolbar('multi', $this->href('monitoring/hosts/show?' . $this->filter->toQueryString())); ?>
<?= $this->filterEditor; ?>
</div>
<?php endif ?>
<div class="content">
<?php
if (count($hosts) === 0) {
echo $this->translate('No hosts found matching the filter') . '</div>';
return;
}
?>
<table
data-base-target="_next"
class="action multiselect"
data-icinga-multiselect-url="<?= $this->href('monitoring/hosts/show') ?>"
data-icinga-multiselect-data="host_name"
>
<tbody>
<?php foreach($hosts as $host):
$hostStateName = Host::getStateText($host->host_state);
$hostLink = $this->href('monitoring/host/show', array('host' => $host->host_name));
$icons = array();
if (! $host->host_handled && $host->host_state > 0){
$icons[] = $this->icon('attention-alt', $this->translate('Unhandled'));
}
if ($host->host_acknowledged) {
$icons[] = $this->icon('ok', $this->translate('Acknowledged'));
}
if ($host->host_is_flapping) {
$icons[] = $this->icon('flapping', $this->translate('Flapping'));
}
if (! $host->host_notifications_enabled) {
$icons[] = $this->icon('bell-off-empty', $this->translate('Notifications Disabled'));
}
if ($host->host_in_downtime) {
$icons[] = $this->icon('plug', $this->translate('In Downtime'));
}
if (! $host->host_active_checks_enabled) {
if (! $host->host_passive_checks_enabled) {
$icons[] = $this->icon('eye-off', $this->translate('Active And Passive Checks Disabled'));
} else {
$icons[] = $this->icon('eye-off', $this->translate('Active Checks Disabled'));
}
}
if (isset($host->host_last_comment) && $host->host_last_comment !== null) {
$icons[] = $this->icon('comment', $this->translate('Last Comment: ') . $host->host_last_comment);
}
?>
<tr class="state <?= $hostStateName ?><?= $host->host_handled ? ' handled' : '' ?>">
<!-- State -->
<td class="state">
<strong><?= Host::getStateText($host->host_state, true); ?></strong><br />
<?php if ((int) $host->host_state !== 99): ?>
<?= $this->prefixedTimeSince($host->host_last_state_change, true) ?>
<?php if ($host->host_state > 0 && (int) $host->host_state_type === 0): ?>
<br />
<strong>Soft <?= $host->host_attempt ?></strong>
<?php endif ?>
<?php endif ?>
</td>
<!-- Host / Status / Output -->
<td>
<?php if ($host->host_icon_image && ! preg_match('/[\'"]/', $host->host_icon_image)): ?>
<?= $this->icon($this->resolveMacros($host->host_icon_image, $host)) ?>
<?php endif ?>
<?= implode(' ', $icons) ?>
<?= $this->qlink(
$host->host_display_name,
$hostLink,
null,
array(
'title' => sprintf($this->translate('Show detailed information for host %s'), $host->host_display_name)
)
); ?>
<?php if (isset($host->host_unhandled_services) && $host->host_unhandled_services > 0): ?>
<span> (<?= $this->qlink(
sprintf(
$this->translatePlural('%u unhandled service', '%u unhandled services', $host->host_unhandled_services),
$host->host_unhandled_services
),
'monitoring/show/services',
array(
'host' => $host->host_name,
'service_problem' => 1,
'service_handled' => 0
),
array(
'style' => 'font-weight: normal',
'title' => sprintf(
$this->translatePlural(
'List %s unhandled service problem on host %s',
'List %s unhandled service problems on host %s',
$host->host_unhandled_services
),
$host->host_unhandled_services,
$host->host_name
)
)
) ?>)</span>
<?php endif ?>
<p class="pluginoutput"><?= $this->escape($this->ellipsis($host->host_output, 10000)) ?></p>
</td>
<?php foreach($this->extraColumns as $col): ?>
<td><?= $this->escape($host->$col) ?></td>
<?php endforeach ?>
</tr>
<?php endforeach ?>
</tbody>
</table>
</div>