commit
f4b33c64dc
|
@ -68,7 +68,7 @@ priority = 70
|
||||||
|
|
||||||
[Overview.Comments]
|
[Overview.Comments]
|
||||||
title = "Comments"
|
title = "Comments"
|
||||||
url = "monitoring/list/comments"
|
url = "monitoring/list/comments?comment_type=(comment|ack)"
|
||||||
priority = 70
|
priority = 70
|
||||||
|
|
||||||
[Overview.Contacts]
|
[Overview.Contacts]
|
||||||
|
|
|
@ -68,7 +68,7 @@ priority = 70
|
||||||
|
|
||||||
[Overview.Comments]
|
[Overview.Comments]
|
||||||
title = "Comments"
|
title = "Comments"
|
||||||
url = "monitoring/list/comments"
|
url = "monitoring/list/comments?comment_type=(comment|ack)"
|
||||||
priority = 70
|
priority = 70
|
||||||
|
|
||||||
[Overview.Contacts]
|
[Overview.Contacts]
|
||||||
|
|
|
@ -221,6 +221,7 @@ class Monitoring_ListController extends Controller
|
||||||
'author' => 'downtime_author',
|
'author' => 'downtime_author',
|
||||||
'start' => 'downtime_start',
|
'start' => 'downtime_start',
|
||||||
'scheduled_start' => 'downtime_scheduled_start',
|
'scheduled_start' => 'downtime_scheduled_start',
|
||||||
|
'scheduled_end' => 'downtime_scheduled_end',
|
||||||
'end' => 'downtime_end',
|
'end' => 'downtime_end',
|
||||||
'duration' => 'downtime_duration',
|
'duration' => 'downtime_duration',
|
||||||
'is_flexible' => 'downtime_is_flexible',
|
'is_flexible' => 'downtime_is_flexible',
|
||||||
|
@ -228,7 +229,9 @@ class Monitoring_ListController extends Controller
|
||||||
'is_in_effect' => 'downtime_is_in_effect',
|
'is_in_effect' => 'downtime_is_in_effect',
|
||||||
'entry_time' => 'downtime_entry_time',
|
'entry_time' => 'downtime_entry_time',
|
||||||
'host' => 'downtime_host',
|
'host' => 'downtime_host',
|
||||||
'service' => 'downtime_service'
|
'service' => 'downtime_service',
|
||||||
|
'host_state' => 'downtime_host_state',
|
||||||
|
'service_state' => 'downtime_service_state'
|
||||||
))->order('downtime_is_in_effect', 'DESC')
|
))->order('downtime_is_in_effect', 'DESC')
|
||||||
->order('downtime_scheduled_start', 'DESC');
|
->order('downtime_scheduled_start', 'DESC');
|
||||||
|
|
||||||
|
|
|
@ -1,98 +1,114 @@
|
||||||
<div class="controls">
|
|
||||||
<?= $this->tabs ?>
|
|
||||||
<div style="margin: 1em">
|
|
||||||
<?= $this->sortControl->render($this); ?>
|
|
||||||
</div>
|
|
||||||
<?= $this->paginationControl($comments, null, null, array('preserve' => $this->preserve)); ?>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="content">
|
|
||||||
<table data-base-target="_next" class="action comments">
|
|
||||||
<tbody>
|
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
$cf = $this->getHelper('CommandForm');
|
$helper = $this->getHelper('CommandForm');
|
||||||
|
|
||||||
if (count($comments) === 0) {
|
|
||||||
echo t('No comments matching the filter');
|
|
||||||
}
|
|
||||||
|
|
||||||
foreach ($comments as $comment):
|
|
||||||
|
|
||||||
?>
|
?>
|
||||||
<tr>
|
|
||||||
<td style="width: 5em; text-align: center;">
|
<?php if (false === $this->compact): ?>
|
||||||
|
<div class="controls">
|
||||||
|
<?= $this->tabs->render($this); ?>
|
||||||
|
<div style="margin: 1em" class="dontprint">
|
||||||
|
<?= $this->translate('Sort by'); ?> <?= $this->sortControl->render($this); ?>
|
||||||
|
</div>
|
||||||
|
<?= $this->widget('limiter', array('url' => $this->url, 'max' => $comments->count())); ?>
|
||||||
|
<?= $this->paginationControl($comments, null, null, array('preserve' => $this->preserve)); ?>
|
||||||
|
</div>
|
||||||
|
<?php endif ?>
|
||||||
|
|
||||||
|
<div class="content">
|
||||||
|
<?php if (empty($comments)): ?>
|
||||||
|
<?= $this->translate('No comments matching the filter') ?>
|
||||||
|
</div>
|
||||||
|
<?php return; endif ?>
|
||||||
|
|
||||||
|
<table data-base-target="_next" class="action comments">
|
||||||
|
<tbody>
|
||||||
|
<?php foreach ($comments as $comment): ?>
|
||||||
<?php
|
<?php
|
||||||
switch ($comment->type) {
|
switch ($comment->type) {
|
||||||
case 'flapping':
|
case 'flapping':
|
||||||
$icon = 'flapping';
|
$icon = 'flapping';
|
||||||
$tooltip = 'Comment was caused by a flapping host or service.';
|
$title = $this->translate('Flapping');
|
||||||
|
$tooltip = $this->translate('Comment was caused by a flapping host or service.');
|
||||||
break;
|
break;
|
||||||
case 'comment':
|
case 'comment':
|
||||||
$icon = 'user';
|
$icon = 'user';
|
||||||
$tooltip = 'Comment was created by an user.';
|
$title = $this->translate('User Comment');
|
||||||
|
$tooltip = $this->translate('Comment was created by an user.');
|
||||||
break;
|
break;
|
||||||
case 'downtime':
|
case 'downtime':
|
||||||
$icon = 'down';
|
$icon = 'down';
|
||||||
$tooltip = 'Comment was caused by a downtime.';
|
$title = $this->translate('Downtime');
|
||||||
|
$tooltip = $this->translate('Comment was caused by a downtime.');
|
||||||
case 'ack':
|
case 'ack':
|
||||||
$icon = 'acknowledgement';
|
$icon = 'acknowledgement';
|
||||||
$tooltip = 'Comment was caused by an acknowledgement.';
|
$title = $this->translate('Acknowledgement');
|
||||||
|
$tooltip = $this->translate('Comment was caused by an acknowledgement.');
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
<?= $this->icon($icon . '.png', $tooltip) ?><br />
|
<tr class="state invalid">
|
||||||
<?= $this->timeSince($comment->timestamp) ?>
|
<td class="state" style="width: 12em;">
|
||||||
|
<?= $this->icon($icon . '.png', $tooltip) ?>
|
||||||
|
<br>
|
||||||
|
<strong><?= $this->escape($title); ?></strong>
|
||||||
|
<br>
|
||||||
|
<?= $this->prefixedTimeSince($comment->timestamp); ?>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<?php if ($comment->objecttype === 'service'): ?><?= $this->icon('service.png', 'Service comment') ?> <?= $this->qlink(
|
<?php if ($comment->objecttype === 'service'): ?>
|
||||||
$comment->service,
|
<?= $this->icon('service.png'); ?> <a href="<?= $this->href('monitoring/show/service', array(
|
||||||
'monitoring/show/service',
|
|
||||||
array(
|
|
||||||
'host' => $comment->host,
|
'host' => $comment->host,
|
||||||
'service' => $comment->service,
|
'service' => $comment->service,
|
||||||
)
|
)); ?>">
|
||||||
) ?> on<?php else: ?><?= $this->icon('host.png', 'Host comment') ?> <?php endif ?> <?= $this->qlink(
|
<?= $comment->service; ?>
|
||||||
$comment->host,
|
</a>
|
||||||
'monitoring/show/host',
|
<small>
|
||||||
array(
|
<?= $this->translate('on') . ' ' . $comment->host; ?>
|
||||||
|
</small>
|
||||||
|
<?php else: ?>
|
||||||
|
<?= $this->icon('host.png'); ?> <a href="<?= $this->href('monitoring/show/host', array(
|
||||||
'host' => $comment->host
|
'host' => $comment->host
|
||||||
)
|
)); ?>">
|
||||||
) ?> by <strong><?= $this->escape($comment->author) ?></strong><br />
|
<?= $comment->host; ?>
|
||||||
<p><?= $this->escape($comment->comment) ?></p>
|
</a>
|
||||||
<?php if ($comment->persistent): ?>Comment is persistent<br /><?php endif ?>
|
<?php endif ?>
|
||||||
<b>Expires: </b> <?=
|
<br>
|
||||||
($comment->expiration) ?
|
<?= $this->icon('comment.png'); ?> <?= isset($comment->author)
|
||||||
$this->timeUntil($comment->expiration) :
|
? '[' . $comment->author . '] '
|
||||||
'Never'
|
: '';
|
||||||
|
?><?= $this->escape($comment->comment); ?>
|
||||||
|
<br>
|
||||||
|
<?= $comment->persistent
|
||||||
|
? $this->translate('This comment is persistent.')
|
||||||
|
: $this->translate('This comment is not persistent.');
|
||||||
?>
|
?>
|
||||||
|
<br>
|
||||||
|
<?= $comment->expiration ? sprintf(
|
||||||
|
$this->translate('This comment expires on %s at %s.'),
|
||||||
|
date('d.m.y', $comment-expiration),
|
||||||
|
date('H:i', $comment->expiration)
|
||||||
|
) : $this->translate('This comment does not expire.'); ?>
|
||||||
</td>
|
</td>
|
||||||
<td style="width: 2em">
|
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
$data = array(
|
$data = array(
|
||||||
'commentid' => $comment->id,
|
'commentid' => $comment->id,
|
||||||
'host' => $comment->host
|
'host' => $comment->host
|
||||||
);
|
);
|
||||||
|
|
||||||
if ($comment->objecttype === 'service') {
|
if ($comment->objecttype === 'service') {
|
||||||
$data['service'] = $comment->service;
|
$data['service'] = $comment->service;
|
||||||
}
|
}
|
||||||
|
?>
|
||||||
// echo $cf->iconSubmitForm(
|
<td style="width: 2em">
|
||||||
// 'img/icons/remove.png',
|
<?= $helper->labelSubmitForm(
|
||||||
echo $cf->labelSubmitForm(
|
|
||||||
'X',
|
'X',
|
||||||
'Remove comment',
|
$this->translate('Remove Comment'),
|
||||||
'link-like',
|
'link-like',
|
||||||
'removecomment',
|
'removecomment',
|
||||||
$data
|
$data
|
||||||
);
|
); ?>
|
||||||
|
|
||||||
?>
|
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<?php endforeach; ?>
|
<?php endforeach ?>
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
</div>
|
</div>
|
|
@ -1,49 +1,101 @@
|
||||||
<?php
|
<?php
|
||||||
$helper = $this->getHelper('CommandForm');
|
$helper = $this->getHelper('CommandForm');
|
||||||
?>
|
?>
|
||||||
|
|
||||||
|
<?php if (false === $this->compact): ?>
|
||||||
<div class="controls">
|
<div class="controls">
|
||||||
<?= $this->tabs ?>
|
<?= $this->tabs->render($this); ?>
|
||||||
<div style="margin: 1em">
|
<div style="margin: 1em" class="dontprint">
|
||||||
<?= $this->sortControl->render($this); ?>
|
<?= $this->translate('Sort by'); ?> <?= $this->sortControl->render($this); ?>
|
||||||
</div>
|
</div>
|
||||||
|
<?= $this->widget('limiter', array('url' => $this->url, 'max' => $downtimes->count())); ?>
|
||||||
<?= $this->paginationControl($downtimes, null, null, array('preserve' => $this->preserve)); ?>
|
<?= $this->paginationControl($downtimes, null, null, array('preserve' => $this->preserve)); ?>
|
||||||
</div>
|
</div>
|
||||||
|
<?php endif ?>
|
||||||
|
|
||||||
|
<div class="content">
|
||||||
|
<?php if (empty($downtimes)): ?>
|
||||||
|
<?= $this->translate('No downtimes matching the filter'); ?>
|
||||||
|
</div>
|
||||||
|
<?php return; endif ?>
|
||||||
|
|
||||||
<div class="content downtimes">
|
|
||||||
<table data-base-target="_next" class="action">
|
<table data-base-target="_next" class="action">
|
||||||
<tbody>
|
<tbody>
|
||||||
|
<?php foreach ($downtimes as $downtime): ?>
|
||||||
<?php
|
<?php
|
||||||
if (count($downtimes) === 0) {
|
if (isset($downtime->service)) {
|
||||||
echo t('No downtimes matching the filter');
|
$stateName = strtolower($this->util()->getServiceStateName($downtime->service_state));
|
||||||
|
} else {
|
||||||
|
$stateName = strtolower($this->util()->getHostStateName($downtime->host_state));
|
||||||
}
|
}
|
||||||
foreach ($this->downtimes as $downtime): ?>
|
?>
|
||||||
<tr>
|
<tr class="state <?= $stateName; ?><?= $downtime->is_in_effect ? ' handled' : ''; ?>">
|
||||||
<td>
|
<td class="state">
|
||||||
<?= $this->dateFormat()->formatDateTime($downtime->start); ?> -
|
<strong><?= $downtime->is_in_effect ? $this->translate('Expires') : $this->translate('Starts'); ?></strong>
|
||||||
<?= $this->dateFormat()->formatDateTime($downtime->end); ?>
|
<br>
|
||||||
<br />
|
<?= $this->prefixedTimeUntil($downtime->is_in_effect ? $downtime->end : $downtime->start); ?>
|
||||||
<small>Duration: <?= $this->util()->showHourMin($downtime->duration); ?></small>
|
|
||||||
<br />
|
|
||||||
<small>The <?php if($downtime->is_flexible): ?>flexible<?php else: ?>fixed<?php endif; ?> downtime is <?php if(!$downtime->is_in_effect): ?>not <?php endif; ?>in effect</small>
|
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<?php if (isset($downtime->service)): ?>
|
<?php if (isset($downtime->service)): ?>
|
||||||
<a href="<?= $this->href('monitoring/show/service', array(
|
<a href="<?= $this->href('monitoring/show/service', array(
|
||||||
'host' => (string) $downtime->host,
|
'host' => $downtime->host,
|
||||||
'service' => (string) $downtime->service
|
'service' => $downtime->service
|
||||||
)); ?>"><?= $downtime->service ?></a>
|
)); ?>">
|
||||||
<small>on <?= $downtime->host ?></small>
|
<?= $downtime->service; ?>
|
||||||
|
</a>
|
||||||
|
<small>
|
||||||
|
<?= $this->translate('on'); ?> <?= $downtime->host; ?>
|
||||||
|
</small>
|
||||||
<?php else: ?>
|
<?php else: ?>
|
||||||
<a href="<?= $this->href('monitoring/show/host', array(
|
<a href="<?= $this->href('monitoring/show/host', array(
|
||||||
'host' => (string) $downtime->host
|
'host' => $downtime->host
|
||||||
)); ?>"><?= $downtime->host ?> </a>
|
)); ?>">
|
||||||
<?php endif; ?>
|
<?= $downtime->host; ?>
|
||||||
<br />
|
</a>
|
||||||
<?= $downtime->author ?>: <?= $downtime->comment ?>
|
<?php endif ?>
|
||||||
<br />
|
<br>
|
||||||
<small>Entry Time: <?= ($downtime->entry_time) ? $this->dateFormat()->formatDateTime((int) $downtime->entry_time) : ''; ?>
|
<?= $this->icon('comment.png'); ?> [<?= $downtime->author; ?>] <?= $downtime->comment; ?>
|
||||||
|
<br>
|
||||||
|
<small>
|
||||||
|
<?php if ($downtime->is_flexible): ?>
|
||||||
|
<?php if ($downtime->is_in_effect): ?>
|
||||||
|
<?= sprintf(
|
||||||
|
$this->translate('This flexible downtime was started on %s at %s and lasts for %s until %s at %s.'),
|
||||||
|
date('d.m.y', $downtime->start),
|
||||||
|
date('H:i', $downtime->start),
|
||||||
|
$this->format()->duration($downtime->duration),
|
||||||
|
date('d.m.y', $downtime->end),
|
||||||
|
date('H:i', $downtime->end)
|
||||||
|
); ?>
|
||||||
|
<?php else: ?>
|
||||||
|
<?= sprintf(
|
||||||
|
$this->translate('This flexible downtime has been scheduled to start between %s - %s and to last for %s.'),
|
||||||
|
date('d.m.y H:i', $downtime->scheduled_start),
|
||||||
|
date('d.m.y H:i', $downtime->scheduled_end),
|
||||||
|
$this->format()->duration($downtime->duration)
|
||||||
|
); ?>
|
||||||
|
<?php endif ?>
|
||||||
|
<?php else: ?>
|
||||||
|
<?php if ($downtime->is_in_effect): ?>
|
||||||
|
<?= sprintf(
|
||||||
|
$this->translate('This fixed downtime was started on %s at %s and expires on %s at %s.'),
|
||||||
|
date('d.m.y', $downtime->start),
|
||||||
|
date('H:i', $downtime->start),
|
||||||
|
date('d.m.y', $downtime->end),
|
||||||
|
date('H:i', $downtime->end)
|
||||||
|
); ?>
|
||||||
|
<?php else: ?>
|
||||||
|
<?= sprintf(
|
||||||
|
$this->translate('This fixed downtime has been scheduled to start on %s at %s and to end on %s at %s.'),
|
||||||
|
date('d.m.y', $downtime->scheduled_start),
|
||||||
|
date('H:i', $downtime->scheduled_start),
|
||||||
|
date('d.m.y', $downtime->scheduled_end),
|
||||||
|
date('H:i', $downtime->scheduled_end)
|
||||||
|
); ?>
|
||||||
|
<?php endif ?>
|
||||||
|
<?php endif ?>
|
||||||
</small>
|
</small>
|
||||||
<td style="width: 2em">
|
</td>
|
||||||
<?php
|
<?php
|
||||||
$data = array(
|
$data = array(
|
||||||
'downtimeid' => $downtime->id,
|
'downtimeid' => $downtime->id,
|
||||||
|
@ -52,16 +104,15 @@ foreach ($this->downtimes as $downtime): ?>
|
||||||
if (isset($downtime->service)) {
|
if (isset($downtime->service)) {
|
||||||
$data['service'] = $downtime->service;
|
$data['service'] = $downtime->service;
|
||||||
}
|
}
|
||||||
// echo $helper->iconSubmitForm(
|
?>
|
||||||
// 'img/icons/remove.png',
|
<td style="width: 2em">
|
||||||
echo $helper->labelSubmitForm(
|
<?= $helper->labelSubmitForm(
|
||||||
'X',
|
'X',
|
||||||
'Remove Downtime',
|
'Remove Downtime',
|
||||||
'link-like',
|
'link-like',
|
||||||
'removedowntime',
|
'removedowntime',
|
||||||
$data
|
$data
|
||||||
);
|
); ?>
|
||||||
?>
|
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<?php endforeach ?>
|
<?php endforeach ?>
|
||||||
|
|
|
@ -1,122 +1,115 @@
|
||||||
|
<?php if (false === $this->compact): ?>
|
||||||
<?php if (!$this->compact): ?>
|
|
||||||
<div class="controls">
|
<div class="controls">
|
||||||
<?= $this->tabs->render($this); ?>
|
<?= $this->tabs->render($this); ?>
|
||||||
<div style="margin: 1em" class="dontprint">
|
<div style="margin: 1em" class="dontprint">
|
||||||
<?= $this->translate('Sort by') ?> <?= $this->sortControl->render($this); ?>
|
<?= $this->translate('Sort by'); ?> <?= $this->sortControl->render($this); ?>
|
||||||
</div>
|
</div>
|
||||||
|
<?= $this->widget('limiter', array('url' => $this->url, 'max' => $this->history->count())); ?>
|
||||||
<?= $this->paginationControl($history, null, null, array('preserve' => $this->preserve)); ?>
|
<?= $this->paginationControl($history, null, null, array('preserve' => $this->preserve)); ?>
|
||||||
</div>
|
</div>
|
||||||
<?php endif; ?>
|
<?php endif ?>
|
||||||
|
|
||||||
<div class="content">
|
<div class="content">
|
||||||
<?php if (empty($history)): ?>
|
<?php if (empty($history)): ?>
|
||||||
<?= $this->translate('No entries found') ?>
|
<?= $this->translate('No history events matching the filter') ?>
|
||||||
</div>
|
</div>
|
||||||
<?php return; endif ?>
|
<?php return; endif ?>
|
||||||
|
|
||||||
<table data-base-target="_next" class="action">
|
<table data-base-target="_next" class="action">
|
||||||
<tbody>
|
<tbody>
|
||||||
<?php
|
|
||||||
if (count($history) === 0) {
|
|
||||||
echo t('No history events matching the filter');
|
|
||||||
}
|
|
||||||
?>
|
|
||||||
<?php foreach ($history as $event): ?>
|
<?php foreach ($history as $event): ?>
|
||||||
<?php
|
<?php
|
||||||
$class = null;
|
$stateName = 'invalid';
|
||||||
$isService = false;
|
$isService = isset($event->service);
|
||||||
switch ($event->type) {
|
switch ($event->type) {
|
||||||
case 'notify':
|
case 'notify':
|
||||||
$icon = 'notification';
|
$icon = 'notification';
|
||||||
$title = 'Notification';
|
$title = $this->translate('Notification');
|
||||||
$msg = $event->output;
|
$msg = $event->output;
|
||||||
break;
|
break;
|
||||||
case 'comment':
|
case 'comment':
|
||||||
$icon = 'comment';
|
$icon = 'comment';
|
||||||
$title = 'Comment';
|
$title = $this->translate('Comment');
|
||||||
$msg = $event->output;
|
$msg = $event->output;
|
||||||
break;
|
break;
|
||||||
case 'ack':
|
case 'ack':
|
||||||
$icon = 'acknowledgement';
|
$icon = 'acknowledgement';
|
||||||
$title = 'Acknowledgement';
|
$title = $this->translate('Acknowledgement');
|
||||||
$msg = $event->output;
|
$msg = $event->output;
|
||||||
break;
|
break;
|
||||||
case 'dt_comment':
|
case 'dt_comment':
|
||||||
$icon = 'in-downtime';
|
$icon = 'in_downtime';
|
||||||
$title = 'In Downtime';
|
$title = $this->translate('In Downtime');
|
||||||
$msg = $event->output;
|
$msg = $event->output;
|
||||||
break;
|
break;
|
||||||
case 'flapping':
|
case 'flapping':
|
||||||
$icon = 'flapping';
|
$icon = 'flapping';
|
||||||
$title = 'Flapping';
|
$title = $this->translate('Flapping');
|
||||||
$msg = $event->output;
|
$msg = $event->output;
|
||||||
break;
|
break;
|
||||||
case 'hard_state':
|
case 'hard_state':
|
||||||
$icon = '{{HARDSTATE_ICON}}';
|
$icon = $isService ? 'service' : 'host';
|
||||||
$title = 'Hard State';
|
$msg = '[ ' . $event->attempt . '/' . $event->max_attempts . ' ] ' . $event->output;
|
||||||
$msg = $event->output . '<br /><small>Attempt ' . $event->attempt . '/' . $event->max_attempts . ' (Hard)</small>';
|
$stateName = (
|
||||||
$class = 'border-status-' . (
|
$isService
|
||||||
$isService ?
|
? strtolower($this->util()->getServiceStateName($event->state))
|
||||||
strtolower($this->util()->getServiceStateName($event->state)) :
|
: strtolower($this->util()->getHostStateName($event->state))
|
||||||
strtolower($this->util()->getHostStateName($event->state))
|
|
||||||
);
|
);
|
||||||
|
$title = strtoupper($stateName); // TODO: Should be translatable!
|
||||||
break;
|
break;
|
||||||
case 'soft_state':
|
case 'soft_state':
|
||||||
$icon = '{{SOFTSTATE_ICON}}';
|
$icon = 'softstate';
|
||||||
$title = 'Soft State';
|
$msg = '[ ' . $event->attempt . '/' . $event->max_attempts . ' ] ' . $event->output;
|
||||||
$msg = $event->output . '<br /><small>Attempt ' . $event->attempt . '/' . $event->max_attempts . ' (Soft)</small>';
|
$stateName = (
|
||||||
$class = 'border-status-' . (
|
$isService
|
||||||
$isService ?
|
? strtolower($this->util()->getServiceStateName($event->state))
|
||||||
strtolower($this->util()->getServiceStateName($event->state)) :
|
: strtolower($this->util()->getHostStateName($event->state))
|
||||||
strtolower($this->util()->getHostStateName($event->state))
|
|
||||||
);
|
);
|
||||||
|
$title = strtoupper($stateName); // TODO: Should be translatable!
|
||||||
break;
|
break;
|
||||||
case 'dt_start':
|
case 'dt_start':
|
||||||
$icon = 'downtime-start';
|
$icon = 'downtime_start';
|
||||||
$title = 'Downtime Start';
|
$title = $this->translate('Downtime Start');
|
||||||
$msg = $event->output;
|
$msg = $event->output;
|
||||||
break;
|
break;
|
||||||
case 'dt_end':
|
case 'dt_end':
|
||||||
$icon = 'downtime-end';
|
$icon = 'downtime_end';
|
||||||
$title = 'Downtime End';
|
$title = $this->translate('Downtime End');
|
||||||
$msg = $event->output;
|
$msg = $event->output;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
<tr class="state">
|
<tr class="state <?= $stateName; ?>">
|
||||||
<td style="width: 6em;" <?= !empty($class) ? 'class="' . $class . '"' : '' ?>">
|
<td class="state">
|
||||||
|
<strong><?= $this->escape($title); ?></strong>
|
||||||
|
<br>
|
||||||
<?= date('d.m. H:i', $event->timestamp); ?>
|
<?= date('d.m. H:i', $event->timestamp); ?>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<?php if (isset($event->service)): ?>
|
<?php if ($isService): ?>
|
||||||
<a href="<?= $this->href('monitoring/show/service', array(
|
<a href="<?= $this->href('monitoring/show/service', array(
|
||||||
'host' => $event->host,
|
'host' => $event->host,
|
||||||
'service' => $event->service
|
'service' => $event->service
|
||||||
)); ?>">
|
)); ?>">
|
||||||
<?= $event->service ?>
|
<?= $event->service; ?>
|
||||||
</a>
|
</a>
|
||||||
<small>
|
<small>
|
||||||
on <?= $event->host ?>
|
<?= $this->translate('on') . ' ' . $event->host; ?>
|
||||||
</small>
|
</small>
|
||||||
<?php $isService = true; ?>
|
|
||||||
<?php else: ?>
|
<?php else: ?>
|
||||||
<a href="<?= $this->href('monitoring/show/host', array(
|
<a href="<?= $this->href('monitoring/show/host', array(
|
||||||
'host' => $event->host
|
'host' => $event->host
|
||||||
)); ?>">
|
)); ?>">
|
||||||
<?= $event->host ?>
|
<?= $event->host; ?>
|
||||||
</a>
|
</a>
|
||||||
<?php endif; ?>
|
<?php endif ?>
|
||||||
<br />
|
<br>
|
||||||
<div>
|
<div>
|
||||||
<i title="<?= $title ?>" class="icinga-icon-<?= $icon ?>"></i>
|
<?= $this->icon($icon . '.png', $title); ?> <?= empty($msg) ? '' : $msg; ?>
|
||||||
<?php if (!empty($msg)) { echo $msg; } ?>
|
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<? endforeach; ?>
|
<? endforeach ?>
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
|
@ -1,146 +1,124 @@
|
||||||
<?php
|
<div class="controls">
|
||||||
|
<?= $this->render('show/components/header.phtml'); ?>
|
||||||
use Icinga\Module\Monitoring\Object\Service;
|
<h1><?= $this->translate('This Object\'s Event History'); ?></h1>
|
||||||
|
<?= $this->widget('limiter', array('url' => $url, 'max' => $history->count())); ?>
|
||||||
if ($object instanceof Service) {
|
<?= $this->paginationControl($history, null, null, array('preserve' => $this->preserve)); ?>
|
||||||
$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->render('show/components/header.phtml') ?>
|
|
||||||
<h1><?= $this->translate("This object's event history") ?></h1>
|
|
||||||
<?= $this->widget('limiter', array('url' => $this->url, 'max' => $this->history->count())) ?>
|
|
||||||
<?= $this->paginationControl($this->history, null, null, array('preserve' => $this->preserve)); ?>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="content">
|
<div class="content">
|
||||||
<?php if($this->history->count() === 0): ?>
|
<?php if (empty($history)): ?>
|
||||||
<?= $this->translate('No History Available For This Object') ?>
|
<?= $this->translate('No history available for this object'); ?>
|
||||||
</div>
|
</div>
|
||||||
<?php return; endif ?>
|
<?php return; endif ?>
|
||||||
|
|
||||||
<table data-base-target="_next" class="action objecthistory">
|
<table data-base-target="_next" class="action objecthistory">
|
||||||
<tbody>
|
<tbody>
|
||||||
|
<?php foreach ($history as $event): ?>
|
||||||
<?php foreach ($this->history as $event):
|
<?php
|
||||||
if (array_key_exists($event->state, $states[$event->object_type])) {
|
$stateClass = 'invalid';
|
||||||
$state_class = $states[$event->object_type][$event->state];
|
$isService = isset($event->service_description);
|
||||||
} else {
|
|
||||||
$state_class = 'invalid';
|
|
||||||
}
|
|
||||||
$extraTitle = false;
|
|
||||||
switch ($event->type) {
|
switch ($event->type) {
|
||||||
case 'notify':
|
case 'notify':
|
||||||
$icon = 'notification';
|
$icon = 'notification';
|
||||||
$title = $this->translate('Notification');
|
$title = $this->translate('Notification');
|
||||||
$state = $this->translate('ACK');
|
$msg = $event->output;
|
||||||
break;
|
break;
|
||||||
case 'comment':
|
case 'comment':
|
||||||
$icon = 'comment';
|
$icon = 'comment';
|
||||||
$title = $this->translate('Comment');
|
$title = $this->translate('Comment');
|
||||||
|
$msg = $event->output;
|
||||||
break;
|
break;
|
||||||
case 'comment_deleted':
|
case 'comment_deleted':
|
||||||
$icon = 'remove';
|
$icon = 'remove';
|
||||||
$title = $this->translate('Comment deleted');
|
$title = $this->translate('Comment deleted');
|
||||||
|
$msg = $event->output;
|
||||||
break;
|
break;
|
||||||
case 'ack':
|
case 'ack':
|
||||||
$icon = 'acknowledgement';
|
$icon = 'acknowledgement';
|
||||||
$title = $this->translate('Acknowledge');
|
$title = $this->translate('Acknowledge');
|
||||||
|
$msg = $event->output;
|
||||||
break;
|
break;
|
||||||
case 'ack_deleted':
|
case 'ack_deleted':
|
||||||
$icon = 'remove';
|
$icon = 'remove';
|
||||||
$title = $this->translate('Ack removed');
|
$title = $this->translate('Ack removed');
|
||||||
|
$msg = $event->output;
|
||||||
break;
|
break;
|
||||||
case 'dt_comment':
|
case 'dt_comment':
|
||||||
$icon = 'in_downtime';
|
$icon = 'in_downtime';
|
||||||
$title = $this->translate('In Downtime');
|
$title = $this->translate('In Downtime');
|
||||||
|
$msg = $event->output;
|
||||||
break;
|
break;
|
||||||
case 'dt_comment_deleted':
|
case 'dt_comment_deleted':
|
||||||
$icon = 'remove';
|
$icon = 'remove';
|
||||||
$title = $this->translate('Downtime removed');
|
$title = $this->translate('Downtime removed');
|
||||||
|
$msg = $event->output;
|
||||||
break;
|
break;
|
||||||
case 'flapping':
|
case 'flapping':
|
||||||
$icon = 'flapping';
|
$icon = 'flapping';
|
||||||
$title = $this->translate('Flapping');
|
$title = $this->translate('Flapping');
|
||||||
|
$msg = $event->output;
|
||||||
break;
|
break;
|
||||||
case 'flapping_deleted':
|
case 'flapping_deleted':
|
||||||
$icon = 'remove';
|
$icon = 'remove';
|
||||||
$title = $this->translate('Flapping stopped');
|
$title = $this->translate('Flapping stopped');
|
||||||
|
$msg = $event->output;
|
||||||
break;
|
break;
|
||||||
case 'hard_state':
|
case 'hard_state':
|
||||||
$icon = 'submit';
|
$icon = $isService ? 'service' : 'host';
|
||||||
$title = strtoupper($state_class);
|
$msg = '[ ' . $event->attempt . '/' . $event->max_attempts . ' ] ' . $event->output;
|
||||||
|
$stateClass = (
|
||||||
|
$isService
|
||||||
|
? strtolower($this->util()->getServiceStateName($event->state))
|
||||||
|
: strtolower($this->util()->getHostStateName($event->state))
|
||||||
|
);
|
||||||
|
$title = strtoupper($stateClass); // TODO: Should be translatable!
|
||||||
break;
|
break;
|
||||||
case 'soft_state':
|
case 'soft_state':
|
||||||
$icon = 'softstate';
|
$icon = 'softstate';
|
||||||
$title = strtoupper($state_class);
|
$msg = '[ ' . $event->attempt . '/' . $event->max_attempts . ' ] ' . $event->output;
|
||||||
$extraTitle = $this->translate('Soft State');
|
$stateClass = (
|
||||||
$state_class .= ' handled';
|
$isService
|
||||||
|
? strtolower($this->util()->getServiceStateName($event->state))
|
||||||
|
: strtolower($this->util()->getHostStateName($event->state))
|
||||||
|
);
|
||||||
|
$title = strtoupper($stateClass); // TODO: Should be translatable!
|
||||||
break;
|
break;
|
||||||
case 'dt_start':
|
case 'dt_start':
|
||||||
$icon = 'downtime_start';
|
$icon = 'downtime_start';
|
||||||
$title = $this->translate('Downtime Start');
|
$title = $this->translate('Downtime Start');
|
||||||
|
$msg = $event->output;
|
||||||
break;
|
break;
|
||||||
case 'dt_end':
|
case 'dt_end':
|
||||||
$icon = 'downtime_end';
|
$icon = 'downtime_end';
|
||||||
$title = $this->translate('Downtime End');
|
$title = $this->translate('Downtime End');
|
||||||
|
$msg = $event->output;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
?>
|
?>
|
||||||
<tr class="state <?= $state_class ?>">
|
<tr class="state <?= $stateClass; ?>">
|
||||||
<td class="state"><strong><?= $this->escape($title) ?></strong><br /><?= $this->prefixedTimeSince($event->timestamp) ?><?= $extraTitle === false ? '' : '<br />' . $this->escape($extraTitle) ?></td>
|
<td class="state">
|
||||||
<td>
|
<strong><?= $this->escape($title); ?></strong>
|
||||||
<?php
|
<br>
|
||||||
|
<?= date('d.m. H:i', $event->timestamp); ?>
|
||||||
|
</td>
|
||||||
|
<td><?php
|
||||||
|
|
||||||
$output = $this->tickets ? preg_replace_callback(
|
$output = $this->tickets ? preg_replace_callback(
|
||||||
$this->tickets->getPattern(),
|
$this->tickets->getPattern(),
|
||||||
array($this->tickets, 'createLink'),
|
array($this->tickets, 'createLink'),
|
||||||
$this->escape($event->output)
|
$this->escape($msg)
|
||||||
) : $this->escape($event->output);
|
) : $this->escape($msg);
|
||||||
|
|
||||||
echo $this->icon($icon . '.png', $title) . ' ';
|
|
||||||
|
|
||||||
if ($object instanceof Host): ?>
|
|
||||||
<?= $this->escape($event->service_description) ?>
|
|
||||||
<?php elseif ($object instanceof Service): ?>
|
|
||||||
<?php else: ?>
|
|
||||||
<?= $this->escape($event->service_description) ?> on <?= $this->escape($event->host_name) ?>
|
|
||||||
<?php endif;
|
|
||||||
|
|
||||||
if ($event->attempt !== null) {
|
|
||||||
printf('[ %d/%d ] ', $event->attempt, $event->max_attempts);
|
|
||||||
}
|
|
||||||
echo $output;
|
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
<?php if ($isService): ?>
|
||||||
|
<?= $this->escape($event->service_description) . ' ' . $this->translate('on') . ' ' . $this->escape($event->host_name); ?>
|
||||||
|
<?php else: ?>
|
||||||
|
<?= $this->escape($event->host_name); ?>
|
||||||
|
<?php endif ?>
|
||||||
|
<br>
|
||||||
|
<div>
|
||||||
|
<?= $this->icon($icon . '.png', $title); ?> <?= empty($msg) ? '' : $msg; ?>
|
||||||
|
</div>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<? endforeach; ?>
|
<? endforeach; ?>
|
||||||
|
|
|
@ -24,13 +24,15 @@ class DowntimeQuery extends IdoQuery
|
||||||
'downtime_scheduled_start' => 'UNIX_TIMESTAMP(sd.scheduled_start_time)',
|
'downtime_scheduled_start' => 'UNIX_TIMESTAMP(sd.scheduled_start_time)',
|
||||||
'downtime_scheduled_end' => 'UNIX_TIMESTAMP(sd.scheduled_end_time)',
|
'downtime_scheduled_end' => 'UNIX_TIMESTAMP(sd.scheduled_end_time)',
|
||||||
'downtime_start' => "UNIX_TIMESTAMP(CASE WHEN sd.trigger_time != '0000-00-00 00:00:00' then sd.trigger_time ELSE sd.scheduled_start_time END)",
|
'downtime_start' => "UNIX_TIMESTAMP(CASE WHEN sd.trigger_time != '0000-00-00 00:00:00' then sd.trigger_time ELSE sd.scheduled_start_time END)",
|
||||||
'downtime_end' => 'UNIX_TIMESTAMP(sd.scheduled_end_time)',
|
'downtime_end' => 'CASE WHEN sd.is_fixed THEN UNIX_TIMESTAMP(sd.scheduled_end_time) ELSE UNIX_TIMESTAMP(sd.trigger_time) + sd.duration END',
|
||||||
'downtime_duration' => 'sd.duration',
|
'downtime_duration' => 'sd.duration',
|
||||||
'downtime_is_in_effect' => 'sd.is_in_effect',
|
'downtime_is_in_effect' => 'sd.is_in_effect',
|
||||||
'downtime_internal_id' => 'sd.internal_downtime_id',
|
'downtime_internal_id' => 'sd.internal_downtime_id',
|
||||||
'downtime_host' => 'CASE WHEN ho.name1 IS NULL THEN so.name1 ELSE ho.name1 END COLLATE latin1_general_ci',
|
'downtime_host' => 'CASE WHEN ho.name1 IS NULL THEN so.name1 ELSE ho.name1 END COLLATE latin1_general_ci',
|
||||||
'downtime_service' => 'so.name2 COLLATE latin1_general_ci',
|
'downtime_service' => 'so.name2 COLLATE latin1_general_ci',
|
||||||
'downtime_objecttype' => "CASE WHEN ho.object_id IS NOT NULL THEN 'host' ELSE CASE WHEN so.object_id IS NOT NULL THEN 'service' ELSE NULL END END",
|
'downtime_objecttype' => "CASE WHEN ho.object_id IS NOT NULL THEN 'host' ELSE CASE WHEN so.object_id IS NOT NULL THEN 'service' ELSE NULL END END",
|
||||||
|
'downtime_host_state' => 'CASE WHEN hs.has_been_checked = 0 OR hs.has_been_checked IS NULL THEN 99 ELSE hs.current_state END',
|
||||||
|
'downtime_service_state' => 'CASE WHEN ss.has_been_checked = 0 OR ss.has_been_checked IS NULL THEN 99 ELSE ss.current_state END'
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -53,6 +55,16 @@ class DowntimeQuery extends IdoQuery
|
||||||
'sd.object_id = so.object_id AND so.is_active = 1 AND so.objecttype_id = 2',
|
'sd.object_id = so.object_id AND so.is_active = 1 AND so.objecttype_id = 2',
|
||||||
array()
|
array()
|
||||||
);
|
);
|
||||||
|
$this->select->joinLeft(
|
||||||
|
array('hs' => $this->prefix . 'hoststatus'),
|
||||||
|
'ho.object_id = hs.host_object_id',
|
||||||
|
array()
|
||||||
|
);
|
||||||
|
$this->select->joinLeft(
|
||||||
|
array('ss' => $this->prefix . 'servicestatus'),
|
||||||
|
'so.object_id = ss.service_object_id',
|
||||||
|
array()
|
||||||
|
);
|
||||||
$this->joinedVirtualTables = array('downtime' => true);
|
$this->joinedVirtualTables = array('downtime' => true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,6 +30,8 @@ class Downtime extends DataView
|
||||||
'downtime_internal_id',
|
'downtime_internal_id',
|
||||||
'downtime_host',
|
'downtime_host',
|
||||||
'downtime_service',
|
'downtime_service',
|
||||||
|
'downtime_host_state',
|
||||||
|
'downtiem_service_state'
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue