icingaweb2/modules/monitoring/application/views/scripts/show/history.phtml

91 lines
2.7 KiB
PHTML

<?= $this->render('show/components/header.phtml') ?>
<?php
$history->limit(10);
$hhistory = $this->history->paginate();
?>
<?php if (empty($hhistory)): ?>
There are no matching history entries right now
<?php else: ?>
<?= $this->paginationControl($hhistory, null, null, array('preserve' => $preserve)); ?>
<table class="paginatable">
<tbody>
<?php foreach ($hhistory as $event): ?>
<?php
if ($event->object_type == 'host') {
$states = array('up', 'down', 'unreachable', 'unknown', 99 => 'pending', null => 'pending');
} else {
$states = array('ok', 'warning', 'critical', 'unknown', 99 => 'pending', null => 'pending');
}
$row_class = array_key_exists($event->state, $states) ? $states[$event->state] : 'invalid';
?>
<tr class="<?= $row_class ?>"><td class="state"><?= date('d.m. H:i', $event->timestamp ) ?></td>
<? if (! $object): ?>
<td><?= $this->escape($event->host_name) ?></td>
<? endif ?>
<? if (! $object instanceof Monitoring\Object\Service): ?>
<td>
<? if ($object): ?>
<a href="<?= $this->href('monitoring/show/service',array(
'host' => $object->host_name,
'service' => $event->service_description
)); ?>"><?php $event->service_description; ?></a>
</a>
<? else: ?>
<?= $this->escape($event->service_description) ?>
<? endif ?>
</td>
<? endif ?>
<td style="padding: 0.2em;"><?php
$imgparams = array(
'width' => 16,
'height' => 16,
);
switch ($event->type) {
case 'notify':
echo $this->img('img/classic/mail-notification.png', $imgparams);
break;
case 'comment':
echo $this->img('img/classic/comment.gif', $imgparams);
break;
case 'ack':
echo $this->img('img/classic/ack.gif', $imgparams);
break;
case 'dt_comment':
echo $this->img('img/classic/downtime.gif', $imgparams);
break;
case 'flapping':
echo $this->img('img/classic/flapping.gif', $imgparams);
break;
case 'hard_state':
echo $this->img('img/classic/state-hard.png', $imgparams);
break;
case 'soft_state':
echo $this->img('img/classic/state-soft.png', $imgparams);
break;
case 'dt_start':
echo $this->img('img/classic/downtime-start.png', $imgparams);
echo ' Downtime start';
break;
case 'dt_end':
echo $this->img('img/classic/downtime-end.png', $imgparams);
echo ' Downtime end';
break;
}
?>
<? if ($event->attempt !== null): ?>
[ <?= $event->attempt ?>/<?=$event->max_attempts ?> ]
<? endif ?>
</td>
</tr>
<? endforeach ?>
</tbody>
</table>
<? endif ?>