Monitoring/History: Show icons and color for state changes

refs #4765
This commit is contained in:
Eric Lippmann 2013-10-16 15:21:31 +02:00
parent 68f20e6231
commit 676f9e5f72
3 changed files with 33 additions and 17 deletions

View File

@ -30,4 +30,4 @@ Hostgroups.title = "Hostgroups"
Hostgroups.route = "/monitoring/list/hostgroups"
History.title = "History"
History.route = "/monitoring/list/eventhistory"
History.route = "/monitoring/list/eventhistory"

View File

@ -1,14 +1,16 @@
<h1>History</h1>
<?php if (!empty($history)): ?>
<div data-icinga-component="app/mainDetailGrid">
<?= $this->paginationControl($history, null, null, array('preserve' => $this->preserve)); ?>
<table class="table table-condensed">
<tbody>
<?php foreach ($history as $event): ?>
<?php
$class = null;
$isService = false;
?>
<tr>
<td><?= date('d.m. H:i', $event->timestamp); ?></td>
<td>
<?php if (isset($event->service)): ?>
<a href="<?= $this->href('monitoring/show/service', array(
@ -17,6 +19,10 @@
)); ?>">
<?= $event->service ?>
</a>
<small>
on <?= $event->host ?>
</small>
<?php $isService = true; ?>
<?php else: ?>
<a href="<?= $this->href('monitoring/show/host', array(
'host' => $event->host
@ -24,60 +30,70 @@
<?= $event->host ?>
</a>
<?php endif; ?>
</td>
<td>
<br />
<?php
switch ($event->type) {
case 'notify':
$icon = '{{NOTIFICATION_ICON}}';
$icon = 'notification';
$title = 'Notification';
$msg = $event->output;
break;
case 'comment':
$icon = '{{COMMENT_ICON}}';
$icon = 'comment';
$title = 'Comment';
$msg = $event->output;
break;
case 'ack':
$icon = '{{ACKNOWLEDGEMENT_ICON}}';
$icon = 'acknowledgement';
$title = 'Acknowledgement';
$msg = $event->output;
break;
case 'dt_comment':
$icon = '{{IN_DOWNTIME_ICON}}';
$icon = 'in-downtime';
$title = 'In Downtime';
$msg = $event->output;
break;
case 'flapping':
$icon = '{{FLAPPING_ICON}}';
$icon = 'flapping';
$title = 'Flapping';
$msg = $event->output;
break;
case 'hard_state':
$icon = '{{HARDSTATE_ICON}}';
$title = 'Hard State';
$msg = '[' . $event->attempt . '/' . $event->max_attempts . ']';
$msg = $event->output . '<br /><small>Attempt ' . $event->attempt . '/' . $event->max_attempts . ' (Hard)</small>';
$class = 'border-status-' . (
$isService ?
strtolower($this->util()->getServiceStateName($event->state)) :
strtolower($this->util()->getHostStateName($event->state))
);
break;
case 'soft_state':
$icon = '{{SOFTSTATE_ICON}}';
$title = 'Soft State';
$msg = '[' . $event->attempt . '/' . $event->max_attempts . ']';
$msg = $event->output . '<br /><small>Attempt ' . $event->attempt . '/' . $event->max_attempts . ' (Soft)</small>';
$class = 'border-status-' . (
$isService ?
strtolower($this->util()->getServiceStateName($event->state)) :
strtolower($this->util()->getHostStateName($event->state))
);
break;
case 'dt_start':
$icon = '{{DOWNTIME_START_ICON}}';
$icon = 'downtime-start';
$title = 'Downtime Start';
$msg = $event->output;
break;
case 'dt_end':
$icon = '{{DOWNTIME_END_ICON}}';
$icon = 'downtime-end';
$title = 'Downtime End';
$msg = $event->output;
break;
}
?>
<a href="#" title="<?= $title ?>"><i><?= $icon ?></i></a>
<?php if (!empty($msg)) { echo $msg; } ?>
<div<?php if (!empty($class)): ?> class="<?= $class ?>"<?php endif; ?>>
<i title="<?= $title ?>" class="icinga-icon-<?= $icon ?>"></i>
<?php if (!empty($msg)) { echo $msg; } ?>
</div>
</td>
</tr>
<? endforeach; ?>