diff --git a/.vagrant-puppet/files/etc/icingaweb/modules/monitoring/menu.ini b/.vagrant-puppet/files/etc/icingaweb/modules/monitoring/menu.ini
index c66a611a9..c185fb87d 100644
--- a/.vagrant-puppet/files/etc/icingaweb/modules/monitoring/menu.ini
+++ b/.vagrant-puppet/files/etc/icingaweb/modules/monitoring/menu.ini
@@ -68,7 +68,7 @@ priority = 70
[Overview.Comments]
title = "Comments"
-url = "monitoring/list/comments"
+url = "monitoring/list/comments?comment_type=(comment|ack)"
priority = 70
[Overview.Contacts]
diff --git a/config/modules/monitoring/menu.ini b/config/modules/monitoring/menu.ini
index c66a611a9..c185fb87d 100644
--- a/config/modules/monitoring/menu.ini
+++ b/config/modules/monitoring/menu.ini
@@ -68,7 +68,7 @@ priority = 70
[Overview.Comments]
title = "Comments"
-url = "monitoring/list/comments"
+url = "monitoring/list/comments?comment_type=(comment|ack)"
priority = 70
[Overview.Contacts]
diff --git a/modules/monitoring/application/controllers/ListController.php b/modules/monitoring/application/controllers/ListController.php
index 7e96ef459..3e02a4757 100644
--- a/modules/monitoring/application/controllers/ListController.php
+++ b/modules/monitoring/application/controllers/ListController.php
@@ -221,6 +221,7 @@ class Monitoring_ListController extends Controller
'author' => 'downtime_author',
'start' => 'downtime_start',
'scheduled_start' => 'downtime_scheduled_start',
+ 'scheduled_end' => 'downtime_scheduled_end',
'end' => 'downtime_end',
'duration' => 'downtime_duration',
'is_flexible' => 'downtime_is_flexible',
@@ -228,7 +229,9 @@ class Monitoring_ListController extends Controller
'is_in_effect' => 'downtime_is_in_effect',
'entry_time' => 'downtime_entry_time',
'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_scheduled_start', 'DESC');
diff --git a/modules/monitoring/application/views/scripts/list/comments.phtml b/modules/monitoring/application/views/scripts/list/comments.phtml
index 3ed671fbe..645c35fb6 100644
--- a/modules/monitoring/application/views/scripts/list/comments.phtml
+++ b/modules/monitoring/application/views/scripts/list/comments.phtml
@@ -1,98 +1,114 @@
+getHelper('CommandForm');
+
+?>
+
+compact): ?>
-= $this->tabs ?>
-
-= $this->sortControl->render($this); ?>
-
-= $this->paginationControl($comments, null, null, array('preserve' => $this->preserve)); ?>
+ = $this->tabs->render($this); ?>
+
+ = $this->translate('Sort by'); ?> = $this->sortControl->render($this); ?>
+
+ = $this->widget('limiter', array('url' => $this->url, 'max' => $comments->count())); ?>
+ = $this->paginationControl($comments, null, null, array('preserve' => $this->preserve)); ?>
+
-
+
\ No newline at end of file
diff --git a/modules/monitoring/application/views/scripts/list/downtimes.phtml b/modules/monitoring/application/views/scripts/list/downtimes.phtml
index 995a66001..babb76074 100644
--- a/modules/monitoring/application/views/scripts/list/downtimes.phtml
+++ b/modules/monitoring/application/views/scripts/list/downtimes.phtml
@@ -1,70 +1,121 @@
getHelper('CommandForm');
?>
-
-= $this->tabs ?>
-
-= $this->sortControl->render($this); ?>
-
-= $this->paginationControl($downtimes, null, null, array('preserve' => $this->preserve)); ?>
-
-
-
-
-downtimes as $downtime): ?>
-
-
- = $this->dateFormat()->formatDateTime($downtime->start); ?> -
- = $this->dateFormat()->formatDateTime($downtime->end); ?>
-
- Duration: = $this->util()->showHourMin($downtime->duration); ?>
-
- The is_flexible): ?>flexiblefixed downtime is is_in_effect): ?>not in effect
- |
-
- service)): ?>
- = $downtime->service ?>
- on = $downtime->host ?>
-
- = $downtime->host ?>
-
-
- = $downtime->author ?>: = $downtime->comment ?>
-
- Entry Time: = ($downtime->entry_time) ? $this->dateFormat()->formatDateTime((int) $downtime->entry_time) : ''; ?>
-
- |
- $downtime->id,
- 'host' => $downtime->host
- );
- if (isset($downtime->service)) {
- $data['service'] = $downtime->service;
- }
- // echo $helper->iconSubmitForm(
- // 'img/icons/remove.png',
- echo $helper->labelSubmitForm(
- 'X',
- 'Remove Downtime',
- 'link-like',
- 'removedowntime',
- $data
- );
- ?>
- |
-
-
-
-
+compact): ?>
+
+ = $this->tabs->render($this); ?>
+
+ = $this->translate('Sort by'); ?> = $this->sortControl->render($this); ?>
+
+ = $this->widget('limiter', array('url' => $this->url, 'max' => $downtimes->count())); ?>
+ = $this->paginationControl($downtimes, null, null, array('preserve' => $this->preserve)); ?>
+
+
+
+
+
+ = $this->translate('No downtimes matching the filter'); ?>
+
+
+
+
+
+
+ service)) {
+ $stateName = strtolower($this->util()->getServiceStateName($downtime->service_state));
+ } else {
+ $stateName = strtolower($this->util()->getHostStateName($downtime->host_state));
+ }
+ ?>
+
+
+ = $downtime->is_in_effect ? $this->translate('Expires') : $this->translate('Starts'); ?>
+
+ = $this->prefixedTimeUntil($downtime->is_in_effect ? $downtime->end : $downtime->start); ?>
+ |
+
+ service)): ?>
+
+ = $downtime->service; ?>
+
+
+ = $this->translate('on'); ?> = $downtime->host; ?>
+
+
+
+ = $downtime->host; ?>
+
+
+
+ = $this->icon('comment.png'); ?> [= $downtime->author; ?>] = $downtime->comment; ?>
+
+
+ is_flexible): ?>
+ 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)
+ ); ?>
+
+ = 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)
+ ); ?>
+
+
+ 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)
+ ); ?>
+
+ = 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)
+ ); ?>
+
+
+
+ |
+ $downtime->id,
+ 'host' => $downtime->host
+ );
+ if (isset($downtime->service)) {
+ $data['service'] = $downtime->service;
+ }
+ ?>
+
+ = $helper->labelSubmitForm(
+ 'X',
+ 'Remove Downtime',
+ 'link-like',
+ 'removedowntime',
+ $data
+ ); ?>
+ |
+
+
+
+
diff --git a/modules/monitoring/application/views/scripts/list/eventhistory.phtml b/modules/monitoring/application/views/scripts/list/eventhistory.phtml
index 55257bae6..56c2198e9 100644
--- a/modules/monitoring/application/views/scripts/list/eventhistory.phtml
+++ b/modules/monitoring/application/views/scripts/list/eventhistory.phtml
@@ -1,122 +1,115 @@
-
-compact): ?>
-
- = $this->tabs->render($this); ?>
-
- = $this->translate('Sort by') ?> = $this->sortControl->render($this); ?>
-
- = $this->paginationControl($history, null, null, array('preserve' => $this->preserve)); ?>
-
-
+compact): ?>
+
+ = $this->tabs->render($this); ?>
+
+ = $this->translate('Sort by'); ?> = $this->sortControl->render($this); ?>
+
+ = $this->widget('limiter', array('url' => $this->url, 'max' => $this->history->count())); ?>
+ = $this->paginationControl($history, null, null, array('preserve' => $this->preserve)); ?>
+
+
-= $this->translate('No entries found') ?>
+ = $this->translate('No history events matching the filter') ?>
-
-
-
-
- type) {
- case 'notify':
- $icon = 'notification';
- $title = 'Notification';
- $msg = $event->output;
- break;
- case 'comment':
- $icon = 'comment';
- $title = 'Comment';
- $msg = $event->output;
- break;
- case 'ack':
- $icon = 'acknowledgement';
- $title = 'Acknowledgement';
- $msg = $event->output;
- break;
- case 'dt_comment':
- $icon = 'in-downtime';
- $title = 'In Downtime';
- $msg = $event->output;
- break;
- case 'flapping':
- $icon = 'flapping';
- $title = 'Flapping';
- $msg = $event->output;
- break;
- case 'hard_state':
- $icon = '{{HARDSTATE_ICON}}';
- $title = 'Hard State';
- $msg = $event->output . '
Attempt ' . $event->attempt . '/' . $event->max_attempts . ' (Hard)';
- $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->output . '
Attempt ' . $event->attempt . '/' . $event->max_attempts . ' (Soft)';
- $class = 'border-status-' . (
- $isService ?
- strtolower($this->util()->getServiceStateName($event->state)) :
- strtolower($this->util()->getHostStateName($event->state))
- );
- break;
- case 'dt_start':
- $icon = 'downtime-start';
- $title = 'Downtime Start';
- $msg = $event->output;
- break;
- case 'dt_end':
- $icon = 'downtime-end';
- $title = 'Downtime End';
- $msg = $event->output;
- break;
- }
- ?>
-
- ">
- = date('d.m. H:i', $event->timestamp); ?>
- |
-
- service)): ?>
-
- = $event->service ?>
-
-
- on = $event->host ?>
-
-
-
-
- = $event->host ?>
-
-
-
-
-
-
-
- |
+
+
+
+ service);
+ switch ($event->type) {
+ case 'notify':
+ $icon = 'notification';
+ $title = $this->translate('Notification');
+ $msg = $event->output;
+ break;
+ case 'comment':
+ $icon = 'comment';
+ $title = $this->translate('Comment');
+ $msg = $event->output;
+ break;
+ case 'ack':
+ $icon = 'acknowledgement';
+ $title = $this->translate('Acknowledgement');
+ $msg = $event->output;
+ break;
+ case 'dt_comment':
+ $icon = 'in_downtime';
+ $title = $this->translate('In Downtime');
+ $msg = $event->output;
+ break;
+ case 'flapping':
+ $icon = 'flapping';
+ $title = $this->translate('Flapping');
+ $msg = $event->output;
+ break;
+ case 'hard_state':
+ $icon = $isService ? 'service' : 'host';
+ $msg = '[ ' . $event->attempt . '/' . $event->max_attempts . ' ] ' . $event->output;
+ $stateName = (
+ $isService
+ ? strtolower($this->util()->getServiceStateName($event->state))
+ : strtolower($this->util()->getHostStateName($event->state))
+ );
+ $title = strtoupper($stateName); // TODO: Should be translatable!
+ break;
+ case 'soft_state':
+ $icon = 'softstate';
+ $msg = '[ ' . $event->attempt . '/' . $event->max_attempts . ' ] ' . $event->output;
+ $stateName = (
+ $isService
+ ? strtolower($this->util()->getServiceStateName($event->state))
+ : strtolower($this->util()->getHostStateName($event->state))
+ );
+ $title = strtoupper($stateName); // TODO: Should be translatable!
+ break;
+ case 'dt_start':
+ $icon = 'downtime_start';
+ $title = $this->translate('Downtime Start');
+ $msg = $event->output;
+ break;
+ case 'dt_end':
+ $icon = 'downtime_end';
+ $title = $this->translate('Downtime End');
+ $msg = $event->output;
+ break;
+ }
+ ?>
+
+
+ = $this->escape($title); ?>
+
+ = date('d.m. H:i', $event->timestamp); ?>
+ |
+
+
+
+ = $event->service; ?>
+
+
+ = $this->translate('on') . ' ' . $event->host; ?>
+
+
+
+ = $event->host; ?>
+
+
+
+
+ = $this->icon($icon . '.png', $title); ?> = empty($msg) ? '' : $msg; ?>
+
+ |
- endforeach; ?>
-
-
-
+ endforeach ?>
+
+
-
diff --git a/modules/monitoring/application/views/scripts/show/history.phtml b/modules/monitoring/application/views/scripts/show/history.phtml
index 57832ae94..f2cfacb23 100644
--- a/modules/monitoring/application/views/scripts/show/history.phtml
+++ b/modules/monitoring/application/views/scripts/show/history.phtml
@@ -1,149 +1,127 @@
-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',
- )
-);
-
-
-?>
-= $this->render('show/components/header.phtml') ?>
-
= $this->translate("This object's event history") ?>
-= $this->widget('limiter', array('url' => $this->url, 'max' => $this->history->count())) ?>
-= $this->paginationControl($this->history, null, null, array('preserve' => $this->preserve)); ?>
+
+ = $this->render('show/components/header.phtml'); ?>
+
= $this->translate('This Object\'s Event History'); ?>
+ = $this->widget('limiter', array('url' => $url, 'max' => $history->count())); ?>
+ = $this->paginationControl($history, null, null, array('preserve' => $this->preserve)); ?>
-history->count() === 0): ?>
-= $this->translate('No History Available For This Object') ?>
+
+ = $this->translate('No history available for this object'); ?>
-
-
-
-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';
-}
-$extraTitle = false;
-switch ($event->type) {
- case 'notify':
- $icon = 'notification';
- $title = $this->translate('Notification');
- $state = $this->translate('ACK');
- break;
- case 'comment':
- $icon = 'comment';
- $title = $this->translate('Comment');
- break;
- case 'comment_deleted':
- $icon = 'remove';
- $title = $this->translate('Comment deleted');
- break;
- case 'ack':
- $icon = 'acknowledgement';
- $title = $this->translate('Acknowledge');
- break;
- case 'ack_deleted':
- $icon = 'remove';
- $title = $this->translate('Ack removed');
- break;
- case 'dt_comment':
- $icon = 'in_downtime';
- $title = $this->translate('In Downtime');
- break;
- case 'dt_comment_deleted':
- $icon = 'remove';
- $title = $this->translate('Downtime removed');
- break;
- case 'flapping':
- $icon = 'flapping';
- $title = $this->translate('Flapping');
- break;
- case 'flapping_deleted':
- $icon = 'remove';
- $title = $this->translate('Flapping stopped');
- break;
- case 'hard_state':
- $icon = 'submit';
- $title = strtoupper($state_class);
- break;
- case 'soft_state':
- $icon = 'softstate';
- $title = strtoupper($state_class);
- $extraTitle = $this->translate('Soft State');
- $state_class .= ' handled';
- break;
- case 'dt_start':
- $icon = 'downtime_start';
- $title = $this->translate('Downtime Start');
- break;
- case 'dt_end':
- $icon = 'downtime_end';
- $title = $this->translate('Downtime End');
- break;
-}
-
-
-
-?>
-
- = $this->escape($title) ?> = $this->prefixedTimeSince($event->timestamp) ?>= $extraTitle === false ? '' : ' ' . $this->escape($extraTitle) ?> |
-
-
+ |
+
+ service_description);
+ switch ($event->type) {
+ case 'notify':
+ $icon = 'notification';
+ $title = $this->translate('Notification');
+ $msg = $event->output;
+ break;
+ case 'comment':
+ $icon = 'comment';
+ $title = $this->translate('Comment');
+ $msg = $event->output;
+ break;
+ case 'comment_deleted':
+ $icon = 'remove';
+ $title = $this->translate('Comment deleted');
+ $msg = $event->output;
+ break;
+ case 'ack':
+ $icon = 'acknowledgement';
+ $title = $this->translate('Acknowledge');
+ $msg = $event->output;
+ break;
+ case 'ack_deleted':
+ $icon = 'remove';
+ $title = $this->translate('Ack removed');
+ $msg = $event->output;
+ break;
+ case 'dt_comment':
+ $icon = 'in_downtime';
+ $title = $this->translate('In Downtime');
+ $msg = $event->output;
+ break;
+ case 'dt_comment_deleted':
+ $icon = 'remove';
+ $title = $this->translate('Downtime removed');
+ $msg = $event->output;
+ break;
+ case 'flapping':
+ $icon = 'flapping';
+ $title = $this->translate('Flapping');
+ $msg = $event->output;
+ break;
+ case 'flapping_deleted':
+ $icon = 'remove';
+ $title = $this->translate('Flapping stopped');
+ $msg = $event->output;
+ break;
+ case 'hard_state':
+ $icon = $isService ? 'service' : 'host';
+ $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;
+ case 'soft_state':
+ $icon = 'softstate';
+ $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;
+ case 'dt_start':
+ $icon = 'downtime_start';
+ $title = $this->translate('Downtime Start');
+ $msg = $event->output;
+ break;
+ case 'dt_end':
+ $icon = 'downtime_end';
+ $title = $this->translate('Downtime End');
+ $msg = $event->output;
+ break;
+ }
+ ?>
+
+
+ = $this->escape($title); ?>
+
+ = date('d.m. H:i', $event->timestamp); ?>
+ |
+ tickets ? preg_replace_callback(
$this->tickets->getPattern(),
array($this->tickets, 'createLink'),
- $this->escape($event->output)
-) : $this->escape($event->output);
-
-echo $this->icon($icon . '.png', $title) . ' ';
-
-if ($object instanceof Host): ?>
- = $this->escape($event->service_description) ?>
-
-
- = $this->escape($event->service_description) ?> on = $this->escape($event->host_name) ?>
-attempt !== null) {
- printf('[ %d/%d ] ', $event->attempt, $event->max_attempts);
-}
-echo $output;
+ $this->escape($msg)
+) : $this->escape($msg);
?>
- |
-
+
+ = $this->escape($event->service_description) . ' ' . $this->translate('on') . ' ' . $this->escape($event->host_name); ?>
+
+ = $this->escape($event->host_name); ?>
+
+
+
+ = $this->icon($icon . '.png', $title); ?> = empty($msg) ? '' : $msg; ?>
+
+
+
endforeach; ?>
-
-
+
+
diff --git a/modules/monitoring/library/Monitoring/Backend/Ido/Query/DowntimeQuery.php b/modules/monitoring/library/Monitoring/Backend/Ido/Query/DowntimeQuery.php
index 324d72c4c..1f5e17c6c 100644
--- a/modules/monitoring/library/Monitoring/Backend/Ido/Query/DowntimeQuery.php
+++ b/modules/monitoring/library/Monitoring/Backend/Ido/Query/DowntimeQuery.php
@@ -24,13 +24,15 @@ class DowntimeQuery extends IdoQuery
'downtime_scheduled_start' => 'UNIX_TIMESTAMP(sd.scheduled_start_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_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_is_in_effect' => 'sd.is_in_effect',
'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_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_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',
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);
}
}
diff --git a/modules/monitoring/library/Monitoring/DataView/Downtime.php b/modules/monitoring/library/Monitoring/DataView/Downtime.php
index 8bd97673a..214e1afb5 100644
--- a/modules/monitoring/library/Monitoring/DataView/Downtime.php
+++ b/modules/monitoring/library/Monitoring/DataView/Downtime.php
@@ -30,6 +30,8 @@ class Downtime extends DataView
'downtime_internal_id',
'downtime_host',
'downtime_service',
+ 'downtime_host_state',
+ 'downtiem_service_state'
);
}