diff --git a/application/controllers/AuthenticationController.php b/application/controllers/AuthenticationController.php index e1622e947..8c4abc506 100644 --- a/application/controllers/AuthenticationController.php +++ b/application/controllers/AuthenticationController.php @@ -71,7 +71,6 @@ class AuthenticationController extends ActionController if ($this->view->form->isPostAndValid()) { - $credentials->setUsername($this->view->form->getValue('username')); $credentials->setPassword($this->view->form->getValue('password')); diff --git a/config/backends.ini.in b/config/backends.ini.in old mode 100644 new mode 100755 diff --git a/config/menu.ini b/config/menu.ini old mode 100644 new mode 100755 diff --git a/config/modules/monitoring/menu.ini b/config/modules/monitoring/menu.ini old mode 100644 new mode 100755 index bd902fd2e..25dd62018 --- a/config/modules/monitoring/menu.ini +++ b/config/modules/monitoring/menu.ini @@ -9,4 +9,5 @@ _1 = 1 Hosts = "/monitoring/list/hosts" Services = "/monitoring/list/services" +Downtimes = "/monitoring/list/downtimes" Summaries = "/monitoring/summary/group/by/hostgroup" diff --git a/modules/monitoring/application/controllers/ListController.php b/modules/monitoring/application/controllers/ListController.php index 2d0b4d281..d9698642c 100644 --- a/modules/monitoring/application/controllers/ListController.php +++ b/modules/monitoring/application/controllers/ListController.php @@ -45,7 +45,6 @@ class Monitoring_ListController extends ModuleActionController 'host_last_comment' ) ); - } public function servicesAction() @@ -86,9 +85,7 @@ class Monitoring_ListController extends ModuleActionController 'service_notes_url', 'service_last_comment' )); - if ($this->_getParam('sort')) { - $this->view->sort = $this->_getParam('sort'); - } + $this->inheritCurrentSortColumn(); } public function hostgroupsAction() @@ -145,6 +142,36 @@ class Monitoring_ListController extends ModuleActionController exit; } + /** + * Fetch the current downtimes and put them into the view + * property 'downtimes' + */ + public function downtimesAction() + { + $query = $this->backend->select() + ->from('downtime',array( + 'host_name', + 'object_type', + 'service_description', + 'downtime_entry_time', + 'downtime_internal_downtime_id', + 'downtime_author_name', + 'downtime_comment_data', + 'downtime_duration', + 'downtime_scheduled_start_time', + 'downtime_scheduled_end_time', + 'downtime_is_fixed', + 'downtime_is_in_effect', + 'downtime_triggered_by_id', + 'downtime_trigger_time' + )); + if (!$this->_getParam('sort')) { + $query->order('downtime_is_in_effect'); + } + $this->view->downtimes = $query->applyRequest($this->_request); + $this->inheritCurrentSortColumn(); + } + protected function query($view, $columns) { $extra = preg_split( @@ -197,6 +224,11 @@ class Monitoring_ListController extends ModuleActionController 'icon' => 'img/classic/server.png', 'url' => 'monitoring/list/hosts', )); + $tabs->add('downtimes', array( + 'title' => 'Downtimes', + 'icon' => 'img/classic/downtime.gif', + 'url' => 'monitoring/list/downtimes', + )); /* $tabs->add('hostgroups', array( 'title' => 'Hostgroups', @@ -221,4 +253,16 @@ class Monitoring_ListController extends ModuleActionController */ return $tabs; } + + + /** + * Let the current response inherit the used sort column by applying it to the + * view property 'sort' + */ + private function inheritCurrentSortColumn() + { + if ($this->_getParam('sort')) { + $this->view->sort = $this->_getParam('sort'); + } + } } diff --git a/modules/monitoring/application/controllers/ShowController.php b/modules/monitoring/application/controllers/ShowController.php index 0ab900172..23ba73b49 100644 --- a/modules/monitoring/application/controllers/ShowController.php +++ b/modules/monitoring/application/controllers/ShowController.php @@ -135,6 +135,30 @@ class Monitoring_ShowController extends ModuleActionController ->where('service_description', $this->view->service->service_description) ->fetchAll(); + $this->view->downtimes = $this->backend->select() + ->from( + 'downtime', + array( + 'host_name', + 'service_description', + 'downtime_type', + 'downtime_author_name', + 'downtime_comment_data', + 'downtime_is_fixed', + 'downtime_duration', + 'downtime_scheduled_start_time', + 'downtime_scheduled_end_time', + 'downtime_actual_start_time', + 'downtime_was_started', + 'downtime_is_in_effect', + 'downtime_internal_downtime_id' + ) + ) + ->where('host_name', $this->view->host->host_name) + ->where('service_description', $this->view->service->service_description) + ->where('object_type','service') + ->fetchAll(); + $this->view->customvars = $this->backend->select() ->from( 'customvar', @@ -236,6 +260,7 @@ class Monitoring_ShowController extends ModuleActionController ) ) ->where('host_name', $this->view->host->host_name) + ->where('object_type','host') ->fetchAll(); $this->view->customvars = $this->backend->select() @@ -368,7 +393,6 @@ class Monitoring_ShowController extends ModuleActionController } } } - /** * Creating tabs for this controller * @return \Icinga\Web\Widget\AbstractWidget diff --git a/modules/monitoring/application/views/scripts/list/downtimes.phtml b/modules/monitoring/application/views/scripts/list/downtimes.phtml new file mode 100644 index 000000000..1decf5052 --- /dev/null +++ b/modules/monitoring/application/views/scripts/list/downtimes.phtml @@ -0,0 +1,159 @@ += $this->tabs ?> + +util()->showTime($d->getTimestamp()); +} +$paginator = $downtimes->paginate(); +$downtimes = $downtimes->fetchAll(); +?> +
+= + $this->paginationControl( + $paginator, + null, + array( + 'mixedPagination.phtml', + 'default'), + array('preserve' => $this->preserve)) +?> + +Is In Effect | +Object | +Host Name | +Service Name | +Entry Time | +Author | +Comment | +Start Time | +End Time | +Type | +Trigger Time | +Downtime ID | +Trigger ID | +Duration | + + +|
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
+ = $downtime->downtime_is_in_effect == 0 ? 'False' : 'True'; ?> + | +
+
+ object_type == 'service'): ?>
+
+
+ object_type == 'host'): ?>
+
+
+
+ |
+ + = $downtime->host_name ?> + | ++ = $downtime->service_description ?> + | ++ = formatDateString($this,$downtime->downtime_entry_time); ?> + | ++ = $downtime->downtime_author_name ?> + | ++ = $downtime->downtime_comment_data ?> + | ++ = formatDateString($this,$downtime->downtime_scheduled_start_time); ?> + | ++ = formatDateString($this,$downtime->downtime_scheduled_end_time); ?> + | ++ = $downtime->downtime_is_fixed == 1 ? 'Fixed' : 'Not Fixed' ?> + | ++ downtime_trigger_time); + echo $date != 'undef' ? $date : 'N/A'; + ?> + | ++ = $downtime->downtime_internal_downtime_id ?> + | ++ = $downtime->downtime_triggered_by_id == 0 ? + 'N/A' : $downtime->downtime_triggered_by_id ?> + | ++ = $this->util()->showHourMin(intval($downtime->downtime_duration)); ?> + | ++ service_description)) { + echo $this->qlink( + '', + 'monitoring/show/host', + array( + 'host' => $downtime->host_name + ), + array( + 'class' => 'row-action' + ) + ); + } else { + echo $this->qlink( + '', + 'monitoring/show/service', + array( + 'host' => $downtime->host_name, + 'service' => $downtime->service_description + ), + array( + 'class' => 'row-action' + ) + ); + } + ?> + | +