diff --git a/config/modules/monitoring/menu.ini b/config/modules/monitoring/menu.ini index 6c69af7ea..5031870b9 100755 --- a/config/modules/monitoring/menu.ini +++ b/config/modules/monitoring/menu.ini @@ -67,7 +67,7 @@ icon = "img/icons/notification.png" [History.Events] title = "All Events" -url = "monitoring/list/eventhistory" +url = "monitoring/list/eventhistory?raw_timestamp>=-2+days" icon = "img/icons/history.png" [System.Performance] diff --git a/modules/monitoring/application/controllers/ListController.php b/modules/monitoring/application/controllers/ListController.php index 4c595de5e..2e0a7c6fc 100644 --- a/modules/monitoring/application/controllers/ListController.php +++ b/modules/monitoring/application/controllers/ListController.php @@ -362,7 +362,7 @@ class Monitoring_ListController extends MonitoringController public function eventhistoryAction() { - $query = EventHistoryView::fromRequest( + $dataview = EventHistoryView::fromRequest( $this->getRequest(), array( 'host_name', @@ -378,12 +378,18 @@ class Monitoring_ListController extends MonitoringController 'host', 'service' ) - )->getQuery(); + ); + + $this->setupFilterControl($dataview, 'eventhistory'); + $this->setupSortControl( + array( + 'raw_timestamp' => 'Occurence' + ) + ); + + $query = $dataview->getQuery(); $this->handleFormatRequest($query); $this->view->history = $query->paginate(); - $this->setupSortControl( - array() - ); } /** diff --git a/modules/monitoring/application/views/scripts/list/eventhistory.phtml b/modules/monitoring/application/views/scripts/list/eventhistory.phtml index 8e5c96d32..4f91e129d 100644 --- a/modules/monitoring/application/views/scripts/list/eventhistory.phtml +++ b/modules/monitoring/application/views/scripts/list/eventhistory.phtml @@ -10,6 +10,15 @@
+
+
+ filterBox->render($this); ?> +
+
+ sortControl->render($this); ?> +
+
+
paginationControl($history, null, null, array('preserve' => $this->preserve)); ?>
diff --git a/modules/monitoring/library/Monitoring/Backend/Ido/Query/EventHistoryQuery.php b/modules/monitoring/library/Monitoring/Backend/Ido/Query/EventHistoryQuery.php index 6ef424559..5b5f63d1a 100644 --- a/modules/monitoring/library/Monitoring/Backend/Ido/Query/EventHistoryQuery.php +++ b/modules/monitoring/library/Monitoring/Backend/Ido/Query/EventHistoryQuery.php @@ -3,7 +3,6 @@ namespace Icinga\Module\Monitoring\Backend\Ido\Query; use \Zend_Db_Select; -use Icinga\Exception\ProgrammingError; class EventHistoryQuery extends IdoQuery { @@ -37,17 +36,9 @@ class EventHistoryQuery extends IdoQuery ); protected $useSubqueryCount = true; - protected $maxCount = 1000; protected function joinBaseTables() { - -// $start = date('Y-m-d H:i:s', time() - 3600 * 24 * 1); - $start = date('Y-m-d H:i:s', time() - 3600 * 24 * 2); - $end = date('Y-m-d H:i:s'); - // TODO: $this->dbTime(...) - //$start = null; - //$end = null; $columns = array( 'raw_timestamp', 'timestamp', @@ -68,16 +59,6 @@ class EventHistoryQuery extends IdoQuery $this->createSubQuery('Notificationhistory', $columns) ); - if ($start) { - foreach ($this->subQueries as $query) { - $query->where('timestamp > ?', $start); - } - } - if ($end) { - foreach ($this->subQueries as $query) { - $query->where('timestamp < ? ', $end); - } - } $sub = $this->db->select()->union($this->subQueries, Zend_Db_Select::SQL_UNION_ALL); $this->baseQuery = $this->db->select()->from( array('eho' => $this->prefix . 'objects'), diff --git a/modules/monitoring/library/Monitoring/DataView/Contact.php b/modules/monitoring/library/Monitoring/DataView/Contact.php index 57c201407..d095e2982 100644 --- a/modules/monitoring/library/Monitoring/DataView/Contact.php +++ b/modules/monitoring/library/Monitoring/DataView/Contact.php @@ -55,7 +55,6 @@ class Contact extends DataView { return array( 'contact_alias' => array( - 'default_dir' => self::SORT_ASC, 'order' => self::SORT_DESC ) ); diff --git a/modules/monitoring/library/Monitoring/DataView/Contactgroup.php b/modules/monitoring/library/Monitoring/DataView/Contactgroup.php index d1d0c6454..dff490c8c 100644 --- a/modules/monitoring/library/Monitoring/DataView/Contactgroup.php +++ b/modules/monitoring/library/Monitoring/DataView/Contactgroup.php @@ -33,7 +33,6 @@ class Contactgroup extends DataView { return array( 'contactgroup_name' => array( - 'default_dir' => self::SORT_ASC, 'order' => self::SORT_DESC ) ); diff --git a/modules/monitoring/library/Monitoring/DataView/EventHistory.php b/modules/monitoring/library/Monitoring/DataView/EventHistory.php index 3ad389a1c..a8a2ecb2f 100644 --- a/modules/monitoring/library/Monitoring/DataView/EventHistory.php +++ b/modules/monitoring/library/Monitoring/DataView/EventHistory.php @@ -63,10 +63,10 @@ class EventHistory extends DataView { return array( 'raw_timestamp' => array( - 'default_dir' => self::SORT_DESC + 'order' => self::SORT_DESC ), 'timestamp' => array( - 'default_dir' => self::SORT_DESC + 'order' => self::SORT_DESC ) ); }