diff --git a/modules/monitoring/application/controllers/ShowController.php b/modules/monitoring/application/controllers/ShowController.php index e0d298fc8..6b2ff3d98 100644 --- a/modules/monitoring/application/controllers/ShowController.php +++ b/modules/monitoring/application/controllers/ShowController.php @@ -86,6 +86,7 @@ class Monitoring_ShowController extends ActionController public function serviceAction() { $this->view->object->prefetch(); + $this->view->object->eventHistory = $this->view->object->eventHistory->limit(10)->fetchAll(); $this->view->preserve = array(); } diff --git a/modules/monitoring/application/views/helpers/MonitoringProperties.php b/modules/monitoring/application/views/helpers/MonitoringProperties.php index 5c434240b..36f238c97 100644 --- a/modules/monitoring/application/views/helpers/MonitoringProperties.php +++ b/modules/monitoring/application/views/helpers/MonitoringProperties.php @@ -268,7 +268,7 @@ class Zend_View_Helper_MonitoringProperties extends Zend_View_Helper_Abstract return $out; } - public function getNotificationType(AbstractObject $notification) + public function getNotificationType($notification) { $reason = intval($notification->notification_reason); if (!isset(self::$notificationReasons[$reason])) { diff --git a/modules/monitoring/application/views/scripts/show/components/eventHistory.phtml b/modules/monitoring/application/views/scripts/show/components/eventHistory.phtml new file mode 100644 index 000000000..fd2eded86 --- /dev/null +++ b/modules/monitoring/application/views/scripts/show/components/eventHistory.phtml @@ -0,0 +1,89 @@ +eventHistory)): ?> +
+
+ History +
+
+ + + eventHistory as $event): ?> + + + + + + + + + +
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; + } + ?> + + +
+
+
+ diff --git a/modules/monitoring/library/Monitoring/Backend/Ido/Query/EventHistoryQuery.php b/modules/monitoring/library/Monitoring/Backend/Ido/Query/EventHistoryQuery.php index c11c8ac65..335b406f7 100644 --- a/modules/monitoring/library/Monitoring/Backend/Ido/Query/EventHistoryQuery.php +++ b/modules/monitoring/library/Monitoring/Backend/Ido/Query/EventHistoryQuery.php @@ -31,6 +31,8 @@ class EventHistoryQuery extends AbstractQuery 'output' => 'eh.output', // we do not want long_output //'problems' => 'CASE WHEN eh.state = 0 OR eh.state IS NULL THEN 0 ELSE 1 END', 'type' => 'eh.type', + 'service_host_name' => 'eho.name1 COLLATE latin1_general_ci', + 'service_description' => 'eho.name2 COLLATE latin1_general_ci' ), 'hostgroups' => array( 'hostgroup' => 'hgo.name1 COLLATE latin1_general_ci', @@ -74,7 +76,7 @@ class EventHistoryQuery extends AbstractQuery } if ($end) { foreach ($this->subQueries as $query) { - $query->where('raw_timestamp', '<' . $start); + $query->where('raw_timestamp', '<' . $end); } } $sub = $this->db->select()->union($this->subQueries, Zend_Db_Select::SQL_UNION_ALL); diff --git a/modules/monitoring/library/Monitoring/Object/AbstractObject.php b/modules/monitoring/library/Monitoring/Object/AbstractObject.php index 982b34930..0dce487c1 100644 --- a/modules/monitoring/library/Monitoring/Object/AbstractObject.php +++ b/modules/monitoring/library/Monitoring/Object/AbstractObject.php @@ -143,7 +143,7 @@ abstract class AbstractObject return $this; } - protected function fetchEventHisoty() + protected function fetchEventHistory() { $this->foreign['eventHistory'] = $this->applyObjectFilter( $this->backend->select()->from('eventHistory', array( @@ -158,6 +158,7 @@ abstract class AbstractObject 'type' )) ); + // echo $this->foreign['eventHistory']->dump();die; return $this; } } diff --git a/modules/monitoring/library/Monitoring/Object/Service.php b/modules/monitoring/library/Monitoring/Object/Service.php index b0d780604..284413589 100644 --- a/modules/monitoring/library/Monitoring/Object/Service.php +++ b/modules/monitoring/library/Monitoring/Object/Service.php @@ -32,7 +32,7 @@ class Service extends AbstractObject ->fetchContactgroups() ->fetchCustomvars() ->fetchComments() - ->fetchEventHisoty(); + ->fetchEventHistory(); } protected function fetchObject()