/usr/share/icingaweb2/modules/monitoring/application/views/scripts/partials/event-history.phtml is in icingaweb2-module-monitoring 2.1.0-1ubuntu1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
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 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 | <?php
use Icinga\Module\Monitoring\Object\Host;
use Icinga\Module\Monitoring\Object\Service;
function contactsLink($match, $view) {
$links = array();
foreach (preg_split('/,\s/', $match[1]) as $contact) {
$links[] = $view->qlink(
$contact,
'monitoring/show/contact',
array('contact_name' => $contact),
array('title' => sprintf($view->translate('Show detailed information about %s'), $contact))
);
}
return '[' . implode(', ', $links) . ']';
}
$self = $this;
$url = $this->url();
$limit = (int) $url->getParam('limit', 25);
if (! $url->hasParam('page') || ($page = (int) $url->getParam('page')) < 1) {
$page = 1;
}
/** @var \Icinga\Module\Monitoring\DataView\EventHistory $history */
$history->limit($limit * $page);
?>
<div class="content">
<?php if (! $history->hasResult()): ?>
<p><?= $this->translate('No historical events found matching the filter.') ?></p>
</div>
<?php return; endif ?>
<table class="state-table" data-base-target="_next"<?php if (isset($tableCssClass)): ?> class="<?=$tableCssClass ?>"<?php endif ?>>
<tbody>
<?php foreach ($history->peekAhead() as $event):
$icon = '';
$iconCssClass = '';
$isService = isset($event->service_description);
$msg = $event->output;
$stateName = 'no-state';
switch ($event->type) {
case 'notify':
$icon = 'bell-alt';
$label = $this->translate('NOTIFICATION');
$msg = $msg ? preg_replace_callback(
'/^\[([^\]]+)\]/',
function($match) use ($self) { return contactsLink($match, $self); },
$msg
) : $this->translate('This notification was not sent out to any contact.');
$stateName = $isService ? Service::getStateText($event->state) : Host::getStateText($event->state);
break;
case 'comment':
$icon = 'comment';
$label = $this->translate('COMMENT');
break;
case 'comment_deleted':
$icon = 'cancel';
$label = $this->translate('COMMENT DELETED');
break;
case 'ack':
$icon = 'ok';
$label = $this->translate('ACKNOWLEDGED');
break;
case 'ack_deleted':
$icon = 'ok';
$iconCssClass = 'icon-strikethrough';
$label = $this->translate('ACKNOWLEDGEMENT REMOVED');
break;
case 'dt_comment':
// TODO(el): Does not appear in history
$icon = 'plug';
$label = $this->translate('SCHEDULED DOWNTIME');
break;
case 'dt_comment_deleted':
// TODO(el): Does not appear in history
$icon = 'plug';
$iconCssClass = 'icon-strikethrough';
$label = $this->translate('DOWNTIME DELETED');
break;
case 'flapping':
// TODO(el): Icon
$label = $this->translate('FLAPPING');
break;
case 'flapping_deleted':
// TODO(el): Icon
$label = $this->translate('FLAPPING STOPPED');
break;
case 'hard_state':
$label = $isService ? Service::getStateText($event->state, true) : Host::getStateText($event->state, true);
$stateName = $isService ? Service::getStateText($event->state) : Host::getStateText($event->state);
break;
case 'soft_state':
$label = $isService ? Service::getStateText($event->state, true) : Host::getStateText($event->state, true);
$stateName = $isService ? Service::getStateText($event->state) : Host::getStateText($event->state);
break;
case 'dt_start':
$icon = 'plug';
$label = $this->translate('DOWNTIME START');
break;
case 'dt_end':
$icon = 'plug';
$iconCssClass = 'icon-strikethrough';
$label = $this->translate('DOWNTIME END');
break;
} ?>
<tr>
<td class="state-col state-<?= $stateName ?>">
<?php if ($history->getIteratorPosition() % $limit === 0): ?>
<a id="page-<?= $history->getIteratorPosition() / $limit + 1 ?>"></a>
<?php endif ?>
<div class="state-label"><?= $this->escape($label) ?></div>
<div class="state-meta"><?= $this->timeAgo($event->timestamp, $this->compact) ?></div>
</td>
<td>
<?php if ($this->isOverview): ?>
<?= $this->qlink(
$event->host_display_name,
'monitoring/host/show',
array(
'host' => $event->host_name,
),
array('title' => sprintf(
$this->translate('Show detailed information for host %s'),
$event->host_display_name
))
) ?><?php if ($isService): ?>:
<?= $this->qlink(
$event->service_display_name,
'monitoring/service/show',
array(
'host' => $event->host_name,
'service' => $event->service_description
),
array(
'class' => 'rowaction',
'title' => sprintf(
$this->translate('Show detailed information for service %s on host %s'),
$event->service_display_name,
$event->host_display_name
)
)
) ?>
<?php endif ?>
<?php endif ?>
<p class="overview-plugin-output">
<?php if ($icon) {
echo $this->icon($icon, null, $iconCssClass ? array('class' => $iconCssClass) : array());
} ?>
<?= nl2br($this->createTicketLinks($this->escape($msg)), false) ?>
</p>
</td>
</tr>
<?php endforeach ?>
</tbody>
</table>
<?php if ($history->hasMore()): ?>
<div class="action-links">
<?php if ($this->compact) {
echo $this->qlink(
$this->translate('Show More'),
$url->without(array('view', 'limit')),
null,
array(
'class' => 'action-link',
'data-base-target' => '_next'
)
);
} else {
echo $this->qlink(
$this->translate('Load More'),
$url->setAnchor('page-' . ($page + 1)),
array('page' => $page + 1,),
array('class' => 'action-link')
);
} ?>
</div>
<?php endif ?>
</div>
|