From 5d0eaa5cd3cd24e4b730835194ea9d6805f8d302 Mon Sep 17 00:00:00 2001 From: Eric Lippmann Date: Fri, 27 Sep 2013 14:38:42 +0200 Subject: [PATCH] List host event history when showing a host refs #4663 --- .../application/controllers/ShowController.php | 1 + .../scripts/show/components/eventHistory.phtml | 16 +++++++++++++++- .../application/views/scripts/show/host.phtml | 2 ++ .../library/Monitoring/Object/AbstractObject.php | 1 - .../library/Monitoring/Object/Host.php | 3 ++- 5 files changed, 20 insertions(+), 3 deletions(-) diff --git a/modules/monitoring/application/controllers/ShowController.php b/modules/monitoring/application/controllers/ShowController.php index 6b2ff3d98..79b6d6c6e 100644 --- a/modules/monitoring/application/controllers/ShowController.php +++ b/modules/monitoring/application/controllers/ShowController.php @@ -96,6 +96,7 @@ class Monitoring_ShowController extends ActionController public function hostAction() { $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/scripts/show/components/eventHistory.phtml b/modules/monitoring/application/views/scripts/show/components/eventHistory.phtml index fd2eded86..fa806a27e 100644 --- a/modules/monitoring/application/views/scripts/show/components/eventHistory.phtml +++ b/modules/monitoring/application/views/scripts/show/components/eventHistory.phtml @@ -11,7 +11,7 @@ timestamp); ?> - + href('monitoring/list/eventhistory', array( + 'host' => $object->host_name, + 'service' => $object->service_description + )); ?>"> + 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 06a02819b..3632e7264 100644 --- a/modules/monitoring/application/views/scripts/show/host.phtml +++ b/modules/monitoring/application/views/scripts/show/host.phtml @@ -15,3 +15,5 @@ render('show/components/flags.phtml'); ?> render('show/components/perfdata.phtml'); ?> + +render('show/components/eventHistory.phtml'); ?> diff --git a/modules/monitoring/library/Monitoring/Object/AbstractObject.php b/modules/monitoring/library/Monitoring/Object/AbstractObject.php index 0dce487c1..408a99029 100644 --- a/modules/monitoring/library/Monitoring/Object/AbstractObject.php +++ b/modules/monitoring/library/Monitoring/Object/AbstractObject.php @@ -158,7 +158,6 @@ abstract class AbstractObject 'type' )) ); - // echo $this->foreign['eventHistory']->dump();die; return $this; } } diff --git a/modules/monitoring/library/Monitoring/Object/Host.php b/modules/monitoring/library/Monitoring/Object/Host.php index a3900439d..c73d27442 100644 --- a/modules/monitoring/library/Monitoring/Object/Host.php +++ b/modules/monitoring/library/Monitoring/Object/Host.php @@ -30,7 +30,8 @@ class Host extends AbstractObject ->fetchContacts() ->fetchContactgroups() ->fetchCustomvars() - ->fetchComments(); + ->fetchComments() + ->fetchEventHistory(); } protected function fetchObject()