2014-02-18 20:17:33 +01:00
|
|
|
<?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);
|
|
|
|
}
|
2013-06-27 10:14:41 +02:00
|
|
|
|
2014-02-18 20:17:33 +01:00
|
|
|
// 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">
|
2014-03-06 20:00:53 +01:00
|
|
|
<?= $this->render('show/components/header.phtml') ?>
|
2014-05-27 23:44:02 +02:00
|
|
|
<h1><?= $this->translate("This object's event history") ?></h1>
|
2014-06-20 14:02:03 +02:00
|
|
|
<?= $this->widget('limiter', array('url' => $this->url, 'max' => $this->history->count())) ?>
|
2014-03-06 20:00:53 +01:00
|
|
|
<?= $this->paginationControl($this->history, null, null, array('preserve' => $this->preserve)); ?>
|
2014-02-18 20:17:33 +01:00
|
|
|
</div>
|
|
|
|
|
2014-06-24 21:23:51 +02:00
|
|
|
<div class="content">
|
2014-03-06 20:00:53 +01:00
|
|
|
<?php if($this->history->count() === 0): ?>
|
2014-05-28 00:16:45 +02:00
|
|
|
<?= $this->translate('No History Available For This Object') ?>
|
2014-02-18 20:17:33 +01:00
|
|
|
</div>
|
|
|
|
<?php return; endif ?>
|
2013-10-15 19:56:33 +02:00
|
|
|
|
2014-06-17 15:32:12 +02:00
|
|
|
<table data-base-target="_next" class="action objecthistory">
|
2014-02-18 20:17:33 +01:00
|
|
|
<tbody>
|
|
|
|
|
2014-03-06 20:00:53 +01:00
|
|
|
<?php foreach ($this->history as $event):
|
2014-02-18 20:17:33 +01:00
|
|
|
if (array_key_exists($event->state, $states[$event->object_type])) {
|
|
|
|
$state_class = $states[$event->object_type][$event->state];
|
|
|
|
} else {
|
|
|
|
$state_class = 'invalid';
|
|
|
|
}
|
2014-06-20 14:02:03 +02:00
|
|
|
$extraTitle = false;
|
2014-02-18 20:17:33 +01:00
|
|
|
switch ($event->type) {
|
|
|
|
case 'notify':
|
|
|
|
$icon = 'notification';
|
2014-06-17 15:32:12 +02:00
|
|
|
$title = $this->translate('Notification');
|
|
|
|
$state = $this->translate('ACK');
|
2014-02-18 20:17:33 +01:00
|
|
|
break;
|
|
|
|
case 'comment':
|
|
|
|
$icon = 'comment';
|
2014-06-17 15:32:12 +02:00
|
|
|
$title = $this->translate('Comment');
|
|
|
|
break;
|
|
|
|
case 'comment_deleted':
|
|
|
|
$icon = 'remove';
|
|
|
|
$title = $this->translate('Comment deleted');
|
2014-02-18 20:17:33 +01:00
|
|
|
break;
|
|
|
|
case 'ack':
|
|
|
|
$icon = 'acknowledgement';
|
2014-06-17 15:32:12 +02:00
|
|
|
$title = $this->translate('Acknowledge');
|
|
|
|
break;
|
|
|
|
case 'ack_deleted':
|
|
|
|
$icon = 'remove';
|
|
|
|
$title = $this->translate('Ack removed');
|
2014-02-18 20:17:33 +01:00
|
|
|
break;
|
|
|
|
case 'dt_comment':
|
|
|
|
$icon = 'in_downtime';
|
2014-06-17 15:32:12 +02:00
|
|
|
$title = $this->translate('In Downtime');
|
|
|
|
break;
|
|
|
|
case 'dt_comment_deleted':
|
|
|
|
$icon = 'remove';
|
|
|
|
$title = $this->translate('Downtime removed');
|
2014-02-18 20:17:33 +01:00
|
|
|
break;
|
|
|
|
case 'flapping':
|
|
|
|
$icon = 'flapping';
|
2014-06-17 15:32:12 +02:00
|
|
|
$title = $this->translate('Flapping');
|
|
|
|
break;
|
|
|
|
case 'flapping_deleted':
|
|
|
|
$icon = 'remove';
|
|
|
|
$title = $this->translate('Flapping stopped');
|
2014-02-18 20:17:33 +01:00
|
|
|
break;
|
|
|
|
case 'hard_state':
|
|
|
|
$icon = 'submit';
|
2014-06-20 14:02:03 +02:00
|
|
|
$title = strtoupper($state_class);
|
2014-02-18 20:17:33 +01:00
|
|
|
break;
|
|
|
|
case 'soft_state':
|
|
|
|
$icon = 'softstate';
|
2014-06-20 14:02:03 +02:00
|
|
|
$title = strtoupper($state_class);
|
|
|
|
$extraTitle = $this->translate('Soft State');
|
2014-06-17 15:32:12 +02:00
|
|
|
$state_class .= ' handled';
|
2014-02-18 20:17:33 +01:00
|
|
|
break;
|
|
|
|
case 'dt_start':
|
|
|
|
$icon = 'downtime_start';
|
2014-06-17 15:32:12 +02:00
|
|
|
$title = $this->translate('Downtime Start');
|
2014-02-18 20:17:33 +01:00
|
|
|
break;
|
|
|
|
case 'dt_end':
|
|
|
|
$icon = 'downtime_end';
|
2014-06-17 15:32:12 +02:00
|
|
|
$title = $this->translate('Downtime End');
|
2014-02-18 20:17:33 +01:00
|
|
|
break;
|
|
|
|
}
|
2014-06-17 15:32:12 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
?>
|
|
|
|
<tr class="state <?= $state_class ?>">
|
2014-06-20 14:02:03 +02:00
|
|
|
<td class="state"><strong><?= $this->escape($title) ?></strong><br /><?= $this->prefixedTimeSince($event->timestamp) ?><?= $extraTitle === false ? '' : '<br />' . $this->escape($extraTitle) ?></td>
|
2014-06-17 15:32:12 +02:00
|
|
|
<td>
|
|
|
|
<?php
|
|
|
|
|
|
|
|
$output = $this->tickets ? preg_replace_callback(
|
|
|
|
$this->tickets->getPattern(),
|
|
|
|
array($this->tickets, 'createLink'),
|
|
|
|
$this->escape($event->output)
|
|
|
|
) : $this->escape($event->output);
|
|
|
|
|
2014-03-06 20:00:53 +01:00
|
|
|
echo $this->icon($icon . '.png', $title) . ' ';
|
2014-02-18 20:17:33 +01:00
|
|
|
|
2014-06-17 15:32:12 +02:00
|
|
|
if ($object instanceof Host): ?>
|
2014-03-08 12:38:31 +01:00
|
|
|
<?= $this->escape($event->service_description) ?>
|
2014-06-17 15:32:12 +02:00
|
|
|
<?php elseif ($object instanceof Service): ?>
|
2014-02-18 20:17:33 +01:00
|
|
|
<?php else: ?>
|
2014-06-17 15:32:12 +02:00
|
|
|
<?= $this->escape($event->service_description) ?> on <?= $this->escape($event->host_name) ?>
|
2014-02-18 20:17:33 +01:00
|
|
|
<?php endif;
|
2013-10-15 19:56:33 +02:00
|
|
|
|
2014-02-18 20:17:33 +01:00
|
|
|
if ($event->attempt !== null) {
|
|
|
|
printf('[ %d/%d ] ', $event->attempt, $event->max_attempts);
|
|
|
|
}
|
|
|
|
echo $output;
|
2013-10-10 11:54:51 +02:00
|
|
|
|
2014-02-18 20:17:33 +01:00
|
|
|
?>
|
|
|
|
</td>
|
|
|
|
</tr>
|
|
|
|
<? endforeach; ?>
|
|
|
|
</tbody>
|
|
|
|
</table>
|
2014-03-08 01:17:42 +01:00
|
|
|
</div>
|