131 lines
3.1 KiB
PHTML
131 lines
3.1 KiB
PHTML
<?php
|
|
|
|
use Icinga\Module\Monitoring\Object\Service;
|
|
|
|
if ($object instanceof Service) {
|
|
$title = $object->service_description;
|
|
$params = array(
|
|
'host' => $object->host_name,
|
|
'service' => $object->service_description
|
|
);
|
|
} else {
|
|
$title = $object->host_name;
|
|
$params = array('host' => $object->host_name);
|
|
}
|
|
|
|
// TODO: Remove this once we have better helpers
|
|
$states = array(
|
|
'service' => array(
|
|
'ok',
|
|
'warning',
|
|
'critical',
|
|
'unknown',
|
|
99 => 'pending',
|
|
),
|
|
'host' => array(
|
|
'up',
|
|
'down',
|
|
'unreachable',
|
|
99 => 'pending',
|
|
)
|
|
);
|
|
|
|
|
|
?><div class="controls">
|
|
<?= $this->tabs->render($this); ?>
|
|
<a href="<?= $this->href('monitoring/list/eventhistory', $params); ?>">All events for <?= $title ?></a>
|
|
<h1>History</h1>
|
|
</div>
|
|
|
|
<?php if($history->count() === 0): ?>
|
|
No History Available For This Object
|
|
</div>
|
|
<?php return; endif ?>
|
|
|
|
<?= $this->paginationControl($history, null, null, array('preserve' => $this->preserve)); ?>
|
|
<table class="action">
|
|
<tbody>
|
|
|
|
<?php foreach ($history as $event):
|
|
if (array_key_exists($event->state, $states[$event->object_type])) {
|
|
$state_class = $states[$event->object_type][$event->state];
|
|
} else {
|
|
$state_class = 'invalid';
|
|
}
|
|
?>
|
|
<tr class="state <?= $state_class ?>">
|
|
<td class="state"><?= $this->timeSince($event->raw_timestamp) ?></td>
|
|
<td>
|
|
<?php
|
|
|
|
$output = $this->ticket_pattern ? preg_replace(
|
|
$this->ticket_pattern,
|
|
$ticket_link,
|
|
$this->pluginOutput($event->output)
|
|
) : $this->pluginOutput($event->output);
|
|
|
|
|
|
switch ($event->type) {
|
|
case 'notify':
|
|
$icon = 'notification';
|
|
$title = 'Notification';
|
|
break;
|
|
case 'comment':
|
|
$icon = 'comment';
|
|
$title = 'Comment';
|
|
break;
|
|
case 'ack':
|
|
$icon = 'acknowledgement';
|
|
$title = 'Acknowledgement';
|
|
break;
|
|
case 'dt_comment':
|
|
$icon = 'in_downtime';
|
|
$title = 'In Downtime';
|
|
break;
|
|
case 'flapping':
|
|
$icon = 'flapping';
|
|
$title = 'Flapping';
|
|
break;
|
|
case 'hard_state':
|
|
$icon = 'submit';
|
|
$title = 'Hard State';
|
|
break;
|
|
case 'soft_state':
|
|
$icon = 'softstate';
|
|
$title = 'Soft State';
|
|
break;
|
|
case 'dt_start':
|
|
$icon = 'downtime_start';
|
|
$title = 'Downtime Start';
|
|
break;
|
|
case 'dt_end':
|
|
$icon = 'downtime_end';
|
|
$title = 'Downtime End';
|
|
break;
|
|
}
|
|
echo $this->img('img/icons/' . $icon . '.png', array('title' => $title)) . ' ';
|
|
|
|
if ($object instanceof Service): ?>
|
|
<a href="<?= $this->href('monitoring/show/service', array(
|
|
'host' => $object->host_name,
|
|
'service' => $event->service_description
|
|
)); ?>"><?= $this->escape($event->service_description) ?></a>
|
|
<?php else: ?>
|
|
<a href="<?= $this->href('monitoring/show/host', array(
|
|
'host' => $object->host_name
|
|
)); ?>"><?= $this->escape($event->host_name) ?></a>
|
|
<?php endif;
|
|
|
|
if ($event->attempt !== null) {
|
|
printf('[ %d/%d ] ', $event->attempt, $event->max_attempts);
|
|
}
|
|
echo $output;
|
|
|
|
?>
|
|
</td>
|
|
</tr>
|
|
<? endforeach; ?>
|
|
</tbody>
|
|
</table>
|
|
|