From 0942a9495876f30193b2391061908b37b182c5d4 Mon Sep 17 00:00:00 2001 From: Thomas Gelf Date: Tue, 18 Feb 2014 19:17:33 +0000 Subject: [PATCH] HTML changes in the monitoring module --- .../views/scripts/list/comments.phtml | 14 +- .../views/scripts/list/hostgroups.phtml | 288 +++++++++++------- .../views/scripts/list/hosts-compact.phtml | 61 ++-- .../views/scripts/list/hosts.phtml | 69 ++--- .../views/scripts/list/services-compact.phtml | 62 ++-- .../views/scripts/list/services.phtml | 122 +++----- .../scripts/show/components/comments.phtml | 38 +-- .../scripts/show/components/downtime.phtml | 4 +- .../scripts/show/components/statusIcons.phtml | 85 +++--- .../views/scripts/show/history.phtml | 225 +++++++------- .../application/views/scripts/show/host.phtml | 4 +- .../views/scripts/show/service.phtml | 4 +- 12 files changed, 508 insertions(+), 468 deletions(-) diff --git a/modules/monitoring/application/views/scripts/list/comments.phtml b/modules/monitoring/application/views/scripts/list/comments.phtml index dab2b4cd1..4950b6166 100644 --- a/modules/monitoring/application/views/scripts/list/comments.phtml +++ b/modules/monitoring/application/views/scripts/list/comments.phtml @@ -67,30 +67,30 @@ comment_objecttype_id === '1'): ?> - + img('img/icons/host.png', array('title' => 'Host comment')) ?> comment_objecttype_id === '2'): ?> - + img('img/icons/service.png', array('title' => 'Service comment')) ?> comment_type) { case 'flapping': - $icon = 'icinga-icon-flapping'; + $icon = 'flapping'; $tooltip = 'Comment was caused by a flapping host or service.'; break; case 'comment': - $icon = 'icinga-icon-user'; + $icon = 'user'; $tooltip = 'Comment was created by an user.'; break; case 'downtime': - $icon = 'icinga-icon-down'; + $icon = 'down'; $tooltip = 'Comment was caused by a downtime.'; case 'ack': - $icon = 'icinga-icon-acknowledgement'; + $icon = 'acknowledgement'; $tooltip = 'Comment was caused by an acknowledgement.'; } ?> - + img('img/icons/' . $icon . '.png', array('title' => $tooltip)) ?> diff --git a/modules/monitoring/application/views/scripts/list/hostgroups.phtml b/modules/monitoring/application/views/scripts/list/hostgroups.phtml index 3f75cc78d..3c59b50db 100644 --- a/modules/monitoring/application/views/scripts/list/hostgroups.phtml +++ b/modules/monitoring/application/views/scripts/list/hostgroups.phtml @@ -1,115 +1,185 @@ -
-
-

Hostgroups

-
-
- tabs->render($this); ?> -
+
+tabs ?> +paginationControl($hostgroups, null, null, array('preserve' => $this->preserve)); ?> + + + + + + + +
HostsServices
-
-
-
-
- sortControl->render($this); ?> -
-
+ + + + + + + + + +
+ hostgroup; ?> -
-
- paginationControl($hostgroups, null, null, array('preserve' => $this->preserve)); ?> -
-
+hosts_up): ?> + + + hosts_up ?> Hosts UP + + + -
-
- selectionToolbar('single'); ?> -
- +hosts_down): ?> + + + hosts_down ?> Hosts DOWN: +hosts_down_unhandled): ?> + hosts_down_unhandled ?> Unhandled + + +hosts_down_handled): ?> + + hosts_down_handled ?> + + + + - - - - - - - - - - -
- - hostgroup; ?> - - - - - -
+hosts_pending): ?> + + + hosts_pending ?> pending + + + +
+services_ok): ?> + + + services_ok ?> OK + + + -
- paginationControl($hostgroups, null, null, array('preserve' => $this->preserve)); ?> -
- +services_critical): ?> + + + services_critical ?> CRITICAL: + +services_critical_unhandled): ?> + services_critical_unhandled ?> Unhandled + +services_critical_handled): ?> + + + services_critical_handled ?> Handled + + + + + + + +services_warning): ?> + + + + services_warning ?> WARNING: + +services_warning_unhandled): ?> + + services_warning_unhandled ?> Unhandled + +services_warning_handled): ?> + + + services_warning_handled ?> Handled + + + + + + + + +services_unknown): ?> + + + services_unknown ?> UNKNOWN: +services_unknown_unhandled): ?> + + services_unknown_unhandled ?> Unhandled + +services_unknown_handled): ?> + + services_unknown_handled ?> Handled + + + + + + +services_pending): ?> + + services_pending ?> + + +
diff --git a/modules/monitoring/application/views/scripts/list/hosts-compact.phtml b/modules/monitoring/application/views/scripts/list/hosts-compact.phtml index 731516ce6..d96abbcf5 100644 --- a/modules/monitoring/application/views/scripts/list/hosts-compact.phtml +++ b/modules/monitoring/application/views/scripts/list/hosts-compact.phtml @@ -1,23 +1,26 @@ +

escape($this->title) ?>

getHelper('MonitoringState'); + +if ($hosts->count() === 0) { + echo '

No host found

'; + return; +} + +?> + +getHelper('MonitoringState'); +foreach($hosts as $host): + + $hostStateName = strtolower($this->util()->getHostStateName($host->host_state)); + $hostLink = $this->href('monitoring/show/host', array('host' => $host->host_name)); + ?> -
-
- - - - - util()->getHostStateName($host->host_state)); ?> - href('monitoring/show/host', array('host' => $host->host_name)); ?> - activeRowHref === $hostLink) ? 'class="active"' : ''; ?> > - - - + - - - - - - -
- -
+ - - - host_name ?> - + + timeSince($host->host_last_state_change) ?> -
- escape(substr(strip_tags($host->host_output), 0, 10000)); ?> -
+ host_name ?>
+ escape(substr(strip_tags($host->host_output), 0, 10000)); ?>
-
+ + + + diff --git a/modules/monitoring/application/views/scripts/list/hosts.phtml b/modules/monitoring/application/views/scripts/list/hosts.phtml index 98ea8d555..bb0e4f241 100644 --- a/modules/monitoring/application/views/scripts/list/hosts.phtml +++ b/modules/monitoring/application/views/scripts/list/hosts.phtml @@ -1,50 +1,36 @@ getHelper('MonitoringState'); ?> -
-
-

Hosts Status

-
-
- tabs->render($this); ?> -
+
+tabs ?> +filterBox->render($this); ?> +sortControl->render($this); ?>
+paginationControl($hosts, null, null, array('preserve' => $this->preserve)); ?> +selectionToolbar('multi', $this->href('monitoring/multi/host',array( 'host' => '*' ))); ?>
+
+count() === 0) { + echo '

No host found

'; + return; +} +?> -
- -
-
-
- filterBox->render($this); ?> -
-
- sortControl->render($this); ?> -
-
- -
- paginationControl($hosts, null, null, array('preserve' => $this->preserve)); ?> -
- -
- selectionToolbar('multi', $this->href('monitoring/multi/host',array( 'host' => '*' ))); ?> -
-
- - +
util()->getHostStateName($host->host_state)); ?> href('monitoring/show/host', array('host' => $host->host_name)); ?> - - + + -
+ - + - + @@ -136,8 +121,4 @@ $viewHelper = $this->getHelper('MonitoringState');
- -
- paginationControl($hosts, null, null, array('preserve' => $this->preserve)); ?> -
diff --git a/modules/monitoring/application/views/scripts/list/services-compact.phtml b/modules/monitoring/application/views/scripts/list/services-compact.phtml index 66682b1a0..bb932b630 100644 --- a/modules/monitoring/application/views/scripts/list/services-compact.phtml +++ b/modules/monitoring/application/views/scripts/list/services-compact.phtml @@ -1,30 +1,30 @@ +

escape($this->title) ?>

+ +getHelper('MonitoringState'); -?> -
+$helper = $this->getHelper('MonitoringState'); -
- - - href( - 'monitoring/show/service', - array( - 'host' => $service->host_name, - 'service' => $service->service_description - ) +foreach ($services as $service): + + $serviceLink = $this->href( + 'monitoring/show/service', + array( + 'host' => $service->host_name, + 'service' => $service->service_description + ) ); $hostLink = $this->href( - 'monitoring/show/host', - array( - 'host' => $service->host_name, - ) + 'monitoring/show/host', + array('host' => $service->host_name) ); $serviceStateName = strtolower($this->util()->getServiceStateName($service->service_state)); - ?> - activeRowHref === $serviceLink) ? 'class="active"' : ''; ?>> +?> + + + + + - -
+timeSince($service->service_last_state_change); ?> + +service_display_name ?> on host_name; ?>
escape(substr(strip_tags($service->service_output), 0, 10000)); ?>
+
-
diff --git a/modules/monitoring/application/views/scripts/list/services.phtml b/modules/monitoring/application/views/scripts/list/services.phtml index 9fcf8019b..7ba68827e 100644 --- a/modules/monitoring/application/views/scripts/list/services.phtml +++ b/modules/monitoring/application/views/scripts/list/services.phtml @@ -1,54 +1,42 @@ getHelper('MonitoringState'); +$helper = $this->getHelper('MonitoringState'); ?> -
-
-

Services Status

-
-
- tabs->render($this); ?> -
+
+tabs ?> +
+filterBox->render($this); ?> +
+
+sortControl->render($this); ?> +

+selectionToolbar('multi', $this->href('monitoring/multi/service', array( 'service' => '*', 'host' => '*' ))); ?> paginationControl($services, null, null, array('preserve' => $this->preserve)); ?>
-
-
-
-
- filterBox->render($this); ?> -
-
- sortControl->render($this); ?> -
-
-
- paginationControl($services, null, null, array('preserve' => $this->preserve)); ?> -
-
- selectionToolbar('multi', $this->href('monitoring/multi/service', array( 'service' => '*', 'host' => '*' ))); ?> -
-
+
+ + + - - - href( - 'monitoring/show/service', - array( - 'host' => $service->host_name, - 'service' => $service->service_description - ) - ); - $hostLink = $this->href( - 'monitoring/show/host', - array( - 'host' => $service->host_name, - ) - ); - $serviceStateName = strtolower($this->util()->getServiceStateName($service->service_state)); - ?> - activeRowHref === $serviceLink) ? 'class="active"' : ''; ?>> +foreach ($services as $service): + $serviceLink = $this->href( + 'monitoring/show/service', + array( + 'host' => $service->host_name, + 'service' => $service->service_description + ) + ); + $hostLink = $this->href( + 'monitoring/show/host', + array( + 'host' => $service->host_name, + ) + ); + $serviceStateName = strtolower($this->util()->getServiceStateName($service->service_state)); +?> + + + + - - - -
+ monitoringState($service, 'service')); ?>
Since timeSince($service->service_last_state_change); ?> service_state): ?>
- Attempt: + service_state_type === '1') ? 'Hard' : 'Soft'; ?> service_attempt; ?> - (service_state_type === '1') ? 'Hard' : 'Soft'; ?>)
- service_icon_image): ?> + + +service_display_name ?> on host_name; ?> +host_state != 0): ?> + (monitoringState($service, 'host')); ?>) + +
escape(substr(strip_tags($service->service_output), 0, 10000)); ?> -
- -
- paginationControl($this->services, null, null, array('preserve' => $this->preserve)); ?> -
- + + +
diff --git a/modules/monitoring/application/views/scripts/show/components/comments.phtml b/modules/monitoring/application/views/scripts/show/components/comments.phtml index 5348bcbc4..2be2f49f8 100644 --- a/modules/monitoring/application/views/scripts/show/components/comments.phtml +++ b/modules/monitoring/application/views/scripts/show/components/comments.phtml @@ -1,33 +1,27 @@ getHelper('CommandForm'); + +/** @var Zend_View_Helper_CommandForm $cf */ +$cf = $this->getHelper('CommandForm'); + +$data = array('host' => $object->host_name); +if ($object->service_description) { + $data['service'] = $object->service_description; +} + ?>
Comments $object->host_name - ); - if ($object->service_description) { - $data['service'] = $object->service_description; - } - $addCommentHref = $this->href( - 'monitoring/command/addComment', - $data - ); - $sendNotificationHref = $this->href( - 'monitoring/command/sendCustomNotification', - $data - ); ?>
@@ -50,7 +44,7 @@ $deleteData['commentid'] = $comment->comment_internal_id; echo $cf->iconSubmitForm( - 'icinga-icon-remove', + 'img/icons/remove.png', 'Remove comment', 'btn-small', 'removecomment', diff --git a/modules/monitoring/application/views/scripts/show/components/downtime.phtml b/modules/monitoring/application/views/scripts/show/components/downtime.phtml index af212f18f..8c4827778 100644 --- a/modules/monitoring/application/views/scripts/show/components/downtime.phtml +++ b/modules/monitoring/application/views/scripts/show/components/downtime.phtml @@ -12,7 +12,7 @@ $scheduleDowntimeHref = $this->href('monitoring/command/scheduleDowntime', $scheduleDowntimeData); ?> - + img('img/icons/in_downtime.png') ?>
Downtimes @@ -32,7 +32,7 @@
getHelper('CommandForm')->iconSubmitForm( - 'icinga-icon-remove', + 'img/icons/remove.png', 'Remove Downtime', 'btn-small', 'removedowntime', diff --git a/modules/monitoring/application/views/scripts/show/components/statusIcons.phtml b/modules/monitoring/application/views/scripts/show/components/statusIcons.phtml index 7611c5193..25a79f497 100644 --- a/modules/monitoring/application/views/scripts/show/components/statusIcons.phtml +++ b/modules/monitoring/application/views/scripts/show/components/statusIcons.phtml @@ -1,57 +1,66 @@ object; $isService = (isset($o->service_description)) ? true : false; - $transitionObject = new \stdClass(); - $transitionObject->handled = + $obj = new \stdClass(); + $obj->handled = ($isService) ? $o->service_handled : $o->host_handled; - $transitionObject->state = + $obj->state = ($isService) ? $o->service_state : $o->host_state; - $transitionObject->acknowledged = + $obj->acknowledged = ($isService) ? $o->service_acknowledged : $o->host_acknowledged; - $transitionObject->in_downtime = + $obj->in_downtime = ($isService) ? $o->in_downtime : $o->host_in_downtime; - $transitionObject->is_flapping = + $obj->is_flapping = ($isService) ? $o->is_flapping : $o->host_is_flapping; - $transitionObject->notifications_enabled = + $obj->notifications_enabled = ($isService) ? $o->notifications_enabled : $o->service_notifications_enabled; - $transitionObject->active_checks_enabled = + $obj->active_checks_enabled = ($isService) ? $o->active_checks_enabled : $o->host_active_checks_enabled; - $transitionObject->passive_checks_enabled = + $obj->passive_checks_enabled = ($isService) ? $o->passive_checks_enabled : $o->host_passive_checks_enabled; - $transitionObject->last_comment = + $obj->last_comment = ($isService) ? $o->last_comment : $o->host_last_comment; -?> - - handled && $transitionObject->state > 0): ?> - - +$i = array(); +if (! $obj->handled && $obj->state > 0) { + $i[] = $this->img('img/icons/unhandled.png', array('title' => 'Unhandled')); +} - acknowledged && !$transitionObject->in_downtime): ?> - - +if ($obj->acknowledged && ! $obj->in_downtime) { + $i[] = $this->img('img/icons/acknowledgement.png', array('title' => 'Acknowledged')); +} - is_flapping): ?> - - +if ($obj->is_flapping) { + $i[] = $this->img('img/icons/flapping.png', array('title' => 'Flapping')); +} - notifications_enabled): ?> - - +if (!$obj->notifications_enabled) { + $i[] = $this->img('img/icons/notification_disabled.png', array('title' => 'Notifications Disabled')); +} - in_downtime): ?> - - +if ($obj->in_downtime) { + $i[] = $this->img('img/icons/in_downtime.png', array('title' => 'In Downtime')); +} - active_checks_enabled): ?> - passive_checks_enabled): ?> - - - - - +if (! $obj->active_checks_enabled) { + if ($obj->passive_checks_enabled) { + $i[] = $this->img( + 'img/icons/active_checks_disabled.png', + array('title' => 'Active Checks Disabled') + ); + } else { + $i[] = $this->img( + 'img/icons/active_passive_checks_disabled.png', + array('title' => 'Active And Passive Checks Disabled') + ); + } +} + +if ($obj->last_comment !== null) { + $i[] = $this->img('img/icons/comment.png', array('title' => 'Comments')); +} + +?> + + - last_comment !== null): ?> - - - \ No newline at end of file diff --git a/modules/monitoring/application/views/scripts/show/history.phtml b/modules/monitoring/application/views/scripts/show/history.phtml index 9a47bbfcd..e10fe9099 100644 --- a/modules/monitoring/application/views/scripts/show/history.phtml +++ b/modules/monitoring/application/views/scripts/show/history.phtml @@ -1,111 +1,130 @@ +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', + ) +); + + +?>
tabs->render($this); ?> - +All events for

History

+
+ count() === 0): ?> -
- No History Available For This Object +No History Available For This Object +
+ -
+paginationControl($history, null, null, array('preserve' => $this->preserve)); ?> + + + +state, $states[$event->object_type])) { + $state_class = $states[$event->object_type][$event->state]; +} else { + $state_class = 'invalid'; +} +?> + + + - - - - - - - - - -
timeSince($event->raw_timestamp) ?> +ticket_pattern ? preg_replace( + $this->ticket_pattern, + $ticket_link, + $this->pluginOutput($event->output) +) : $this->pluginOutput($event->output); + + +switch ($event->type) { + case 'notify': + $icon = 'notification'; + $title = 'Notification'; + break; + case 'comment': + $icon = 'comment'; + $title = 'Comment'; + break; + case 'ack': + $icon = 'acknowledgement'; + $title = 'Acknowledgement'; + break; + case 'dt_comment': + $icon = 'in_downtime'; + $title = 'In Downtime'; + break; + case 'flapping': + $icon = 'flapping'; + $title = 'Flapping'; + break; + case 'hard_state': + $icon = 'submit'; + $title = 'Hard State'; + break; + case 'soft_state': + $icon = 'softstate'; + $title = 'Soft State'; + break; + case 'dt_start': + $icon = 'downtime_start'; + $title = 'Downtime Start'; + break; + case 'dt_end': + $icon = 'downtime_end'; + $title = 'Downtime End'; + break; +} +echo $this->img('img/icons/' . $icon . '.png', array('title' => $title)) . ' '; + +if ($object instanceof Service): ?> + escape($event->service_description) ?> + escape($event->host_name) ?> + +if ($event->attempt !== null) { + printf('[ %d/%d ] ', $event->attempt, $event->max_attempts); +} +echo $output; - paginationControl($history, null, null, array('preserve' => $this->preserve)); ?> - - +?> + + + + +
- -
raw_timestamp); ?> - - - service_description ?> - - - - host_name ?> - - - - type) { - case 'notify': - $icon = '{{NOTIFICATION_ICON}}'; - $title = 'Notification'; - $msg = $event->output; - break; - case 'comment': - $icon = '{{COMMENT_ICON}}'; - $title = 'Comment'; - $msg = $event->output; - break; - case 'ack': - $icon = '{{ACKNOWLEDGEMENT_ICON}}'; - $title = 'Acknowledgement'; - $msg = ''; - break; - case 'dt_comment': - $icon = '{{IN_DOWNTIME_ICON}}'; - $title = 'In Downtime'; - $msg = $event->output; - break; - case 'flapping': - $icon = '{{FLAPPING_ICON}}'; - $title = 'Flapping'; - $msg = ''; - break; - case 'hard_state': - $icon = '{{HARDSTATE_ICON}}'; - $title = 'Hard State'; - $msg = '[' . $event->attempt . '/' . $event->max_attempts . ']'; - break; - case 'soft_state': - $icon = '{{SOFTSTATE_ICON}}'; - $title = 'Soft State'; - $msg = '[' . $event->attempt . '/' . $event->max_attempts . ']'; - break; - case 'dt_start': - $icon = '{{DOWNTIME_START_ICON}}'; - $title = 'Downtime Start'; - $msg = $event->output; - break; - case 'dt_end': - $icon = '{{DOWNTIME_END_ICON}}'; - $title = 'Downtime End'; - $msg = $event->output; - break; - } - ?> - - -
- - - All events for service_description ?> - - - - All events for host_name ?> - - -
- diff --git a/modules/monitoring/application/views/scripts/show/host.phtml b/modules/monitoring/application/views/scripts/show/host.phtml index 8c482053b..c3e143270 100644 --- a/modules/monitoring/application/views/scripts/show/host.phtml +++ b/modules/monitoring/application/views/scripts/show/host.phtml @@ -1,4 +1,6 @@ -tabs->render($this); ?> +
+tabs ?> +
render('show/components/status.phtml'); ?> render('show/components/comments.phtml'); ?> render('show/components/downtime.phtml'); ?> diff --git a/modules/monitoring/application/views/scripts/show/service.phtml b/modules/monitoring/application/views/scripts/show/service.phtml index 0b0166efd..b9ecb469c 100644 --- a/modules/monitoring/application/views/scripts/show/service.phtml +++ b/modules/monitoring/application/views/scripts/show/service.phtml @@ -1,4 +1,6 @@ -tabs->render($this); ?> +
+tabs; ?> +
render('show/components/status.phtml'); ?> render('show/components/comments.phtml'); ?> render('show/components/downtime.phtml'); ?>