diff --git a/application/layouts/scripts/parts/topbar.phtml b/application/layouts/scripts/parts/topbar.phtml index 049a2ab3a..57e5b0dd8 100755 --- a/application/layouts/scripts/parts/topbar.phtml +++ b/application/layouts/scripts/parts/topbar.phtml @@ -1,27 +1,28 @@ diff --git a/config/modules/monitoring/menu.ini b/config/modules/monitoring/menu.ini index 2a6dae3ca..058b6162f 100755 --- a/config/modules/monitoring/menu.ini +++ b/config/modules/monitoring/menu.ini @@ -1,14 +1,18 @@ [menu] -Issues.title = "Issues" ; Extended version -Issues.route = "/monitoring/list/services?problems=1&sort=severity" ; Explicit route -Issues.key = "issues" ; When this key is set in the controller, the item is active +;Remove component as of #4583 since it's not working +;Issues.title = "Issues" ; Extended version +;Issues.route = "/monitoring/list/services?problems=1&sort=severity" ; Explicit route +;Issues.key = "issues" ; When this key is set in the controller, the item is active -Changes.title = "Recent Changes" -Changes.route = "/monitoring/list/services?sort=service_last_state_change" -_1 = 1 ;Spacer after this section +;Remove component as of #4583 since it's not working +;Changes.title = "Recent Changes" +;Changes.route = "/monitoring/list/services?sort=service_last_state_change" +;_1 = 1 ;Spacer after this section Hosts = "/monitoring/list/hosts" Services = "/monitoring/list/services" Downtimes = "/monitoring/list/downtimes" Notifications = "/monitoring/list/notifications" -Summaries = "/monitoring/summary/group/by/hostgroup" + +;Remove component as of #4583 since it's not working +;Summaries = "/monitoring/summary/group/by/hostgroup" diff --git a/modules/monitoring/application/controllers/ListController.php b/modules/monitoring/application/controllers/ListController.php index f1947ea02..7eb173713 100644 --- a/modules/monitoring/application/controllers/ListController.php +++ b/modules/monitoring/application/controllers/ListController.php @@ -26,21 +26,25 @@ * @author Icinga Development Team */ // {{{ICINGA_LICENSE_HEADER}}} -use Icinga\Web\Controller\ModuleActionController; -use Icinga\Web\Hook; -use Icinga\File\Csv; -use Monitoring\Backend; -use Icinga\Application\Benchmark; -use Icinga\Web\Widget\Tabextension\OutputFormat; -use Icinga\Web\Widget\Tabextension\DashboardAction; -use Icinga\Web\Widget\Tabextension\BasketAction; + + +use \Icinga\Application\Benchmark; +use \Icinga\Data\Db\Query; +use \Icinga\File\Csv; +use \Icinga\Web\Controller\ModuleActionController; +use \Icinga\Web\Hook; +use \Icinga\Web\Widget\Tabextension\BasketAction; +use \Icinga\Web\Widget\Tabextension\DashboardAction; +use \Icinga\Web\Widget\Tabextension\OutputFormat; +use \Icinga\Web\Widget\Tabs; +use \Monitoring\Backend; class Monitoring_ListController extends ModuleActionController { /** * The backend used for this controller * - * @var \Icinga\Backend + * @var Backend */ protected $backend; @@ -48,9 +52,9 @@ class Monitoring_ListController extends ModuleActionController * Set to a string containing the compact layout name to use when * 'compact' is set as the layout parameter, otherwise null * - * @var string|null + * @var string */ - private $compactView = null; + private $compactView; /** * Retrieve backend and hooks for this controller @@ -101,8 +105,7 @@ class Monitoring_ListController extends ModuleActionController */ public function servicesAction() { - $state_type = $this->_getParam('_statetype', 'soft'); - if ($state_type = 'soft') { + if ($this->_getParam('_statetype', 'soft') === 'soft') { $state_column = 'service_state'; $state_change_column = 'service_last_state_change'; } else { @@ -111,7 +114,6 @@ class Monitoring_ListController extends ModuleActionController } $this->compactView = "services-compact"; - $this->view->services = $this->query('status', array( 'host_name', 'host_state', @@ -143,50 +145,7 @@ class Monitoring_ListController extends ModuleActionController } /** - * Display hostgroup list - * - * @TODO Implement hostgroup overview (feature #4184) - */ - public function hostgroupsAction() - { - $this->view->hostgroups = $this->backend->select() - ->from('hostgroup', array( - 'hostgroup_name', - 'hostgroup_alias', - ))->applyRequest($this->_request); - } - - /** - * Display servicegroup list - * - * @TODO Implement servicegroup overview (feature #4185) - */ - public function servicegroupsAction() - { - $this->view->servicegroups = $this->backend->select() - ->from('servicegroup', array( - 'servicegroup_name', - 'servicegroup_alias', - ))->applyRequest($this->_request); - } - - /** - * Display contactgroups overview - * - * - */ - public function contactgroupsAction() - { - $this->view->contactgroups = $this->backend->select() - ->from('contactgroup', array( - 'contactgroup_name', - 'contactgroup_alias', - ))->applyRequest($this->_request); - } - - /** - * Fetch the current downtimes and put them into the view - * property 'downtimes' + * Fetch the current downtimes and put them into the view property `downtimes` */ public function downtimesAction() { @@ -239,7 +198,15 @@ class Monitoring_ListController extends ModuleActionController $this->inheritCurrentSortColumn(); } - protected function query($view, $columns) + /** + * Create query + * + * @param string $view + * @param array $columns + * + * @return Query + */ + private function query($view, $columns) { $extra = preg_split( '~,~', @@ -259,9 +226,9 @@ class Monitoring_ListController extends ModuleActionController /** * Handle the 'format' and 'view' parameter * - * @param \Icinga\Data\Db\Query $query The current query + * @param Query $query The current query */ - protected function handleFormatRequest($query) + private function handleFormatRequest($query) { if ($this->compactView !== null && ($this->_getParam('view', false) === 'compact')) { $this->_helper->viewRenderer($this->compactView); @@ -292,63 +259,17 @@ class Monitoring_ListController extends ModuleActionController * * @return Tabs */ - protected function createTabs() + private function createTabs() { $tabs = $this->getTabs(); $tabs->extend(new OutputFormat()) ->extend(new DashboardAction()) ->extend(new BasketAction()); - - $tabs->add('services', array( - 'title' => 'All services', - 'icon' => 'img/classic/service.png', - 'url' => 'monitoring/list/services', - )); - $tabs->add('hosts', array( - 'title' => 'All hosts', - 'icon' => 'img/classic/server.png', - 'url' => 'monitoring/list/hosts', - )); - $tabs->add('downtimes', array( - 'title' => 'Downtimes', - 'usePost' => true, - 'icon' => 'img/classic/downtime.gif', - 'url' => 'monitoring/list/downtimes', - )); - $tabs->add('notifications', array( - 'title' => 'Notifications', - 'icon' => 'img/classic/alarm-clock.png', - 'url' => 'monitoring/list/notifications' - )); -/* - $tabs->add('hostgroups', array( - 'title' => 'Hostgroups', - 'icon' => 'img/classic/servers-network.png', - 'url' => 'monitoring/list/hostgroups', - )); - $tabs->add('servicegroups', array( - 'title' => 'Servicegroups', - 'icon' => 'img/classic/servers-network.png', - 'url' => 'monitoring/list/servicegroups', - )); - $tabs->add('contacts', array( - 'title' => 'Contacts', - 'icon' => 'img/classic/servers-network.png', - 'url' => 'monitoring/list/contacts', - )); - $tabs->add('contactgroups', array( - 'title' => 'Contactgroups', - 'icon' => 'img/classic/servers-network.png', - 'url' => 'monitoring/list/contactgroups', - )); -*/ } - /** - * Let the current response inherit the used sort column by applying it to the - * view property 'sort' + * Let the current response inherit the used sort column by applying it to the view property `sort` */ private function inheritCurrentSortColumn() { diff --git a/modules/monitoring/application/controllers/SummaryController.php b/modules/monitoring/application/controllers/SummaryController.php deleted file mode 100644 index 5f4699385..000000000 --- a/modules/monitoring/application/controllers/SummaryController.php +++ /dev/null @@ -1,94 +0,0 @@ - - * @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2 - * @author Icinga Development Team - */ -// {{{ICINGA_LICENSE_HEADER}}} -use Icinga\Web\Controller\ModuleActionController; -use Icinga\Backend; - -class Monitoring_SummaryController extends ModuleActionController -{ - protected $backend; - protected $host; - protected $service; - - public function init() - { - $this->backend = Backend::getInstance($this->_getParam('backend')); - $this->view->tabs = $this->getTabs(); - } - - protected function createTabs() - { - $tabs = $this->getTabs(); - $tabs->add('hostgroup', array( - 'title' => 'Hostgroups', - 'url' => 'monitoring/summary/group', - 'urlParams' => array('by' => 'hostgroup'), - )); - $tabs->add('servicegroup', array( - 'title' => 'Servicegroups', - 'url' => 'monitoring/summary/group', - 'urlParams' => array('by' => 'servicegroup'), - )); - $tabs->activate($this->_getParam('by', 'hostgroup')); - return $tabs; - } - - public function historyAction() - { - $this->_helper->viewRenderer('history'); - } - - public function groupAction() - { - if ($this->_getParam('by') === 'servicegroup') { - $view = 'servicegroupsummary'; - } else { - $view = 'hostgroupsummary'; - } - if (! $this->backend->hasView($view)) { - $this->view->backend = $this->backend; - $this->view->view_name = $view; - $this->_helper->viewRenderer('backend-is-missing'); - return; - } - - $this->view->preserve = array( - 'problems' => $this->_getParam('problems') ? 'true' : 'false', - 'search' => $this->_getParam('search') - ); - $query = $this->backend->select()->from($view); - $query->where('problems', $this->_getParam('problems') ? 'true' : 'false'); - //$query->where('ss.current_state > 0'); - $query->where('search', $this->_getParam('search')); - - // echo '
' . $query->dump() . '
'; exit; - $this->view->summary = $query->paginate(); - - } -} -// @codingStandardsIgnoreEnd diff --git a/modules/monitoring/application/views/scripts/list/contactgroups.phtml b/modules/monitoring/application/views/scripts/list/contactgroups.phtml deleted file mode 100644 index 77bef0553..000000000 --- a/modules/monitoring/application/views/scripts/list/contactgroups.phtml +++ /dev/null @@ -1,5 +0,0 @@ -tabs->render($this); ?> - -
-escape(print_r($this->contactgroups->fetchAll(), 1)) ?>
-
diff --git a/modules/monitoring/application/views/scripts/list/downtimes.phtml b/modules/monitoring/application/views/scripts/list/downtimes.phtml index ca28045bf..de4ef74b2 100644 --- a/modules/monitoring/application/views/scripts/list/downtimes.phtml +++ b/modules/monitoring/application/views/scripts/list/downtimes.phtml @@ -41,7 +41,6 @@ $downtimes = $downtimes->fetchAll(); 'downtime_duration' => 'Duration', ) ) ?> - tabs->render($this); ?> - -
-escape(print_r($this->hostgroups->fetchAll(), 1)) ?>
-
diff --git a/modules/monitoring/application/views/scripts/list/hosts.phtml b/modules/monitoring/application/views/scripts/list/hosts.phtml index adc6aa477..325c3800b 100644 --- a/modules/monitoring/application/views/scripts/list/hosts.phtml +++ b/modules/monitoring/application/views/scripts/list/hosts.phtml @@ -20,7 +20,6 @@ $trimArea = $this->getHelper('Trim'); 'host_name' => 'Host', ) ) ?> - paginationControl($hosts, null, null, array('preserve' => $this->preserve)) ?> @@ -45,14 +44,14 @@ $trimArea = $this->getHelper('Trim'); end(); ?> - +
start(); ?> host_handled && $host->host_state > 0): ?> - - host_acknowledged && !$host->host_in_downtime): ?> + + host_acknowledged && !$host->host_in_downtime): ?> @@ -61,7 +60,7 @@ $trimArea = $this->getHelper('Trim'); - + host_notifications_enabled): ?> @@ -72,7 +71,7 @@ $trimArea = $this->getHelper('Trim'); - end(); ?>
+ end(); ?>
@@ -92,7 +91,7 @@ $trimArea = $this->getHelper('Trim');
- + host_last_comment !== null): ?> diff --git a/modules/monitoring/application/views/scripts/list/notifications.phtml b/modules/monitoring/application/views/scripts/list/notifications.phtml index fd3aebf5f..41bf12f3b 100644 --- a/modules/monitoring/application/views/scripts/list/notifications.phtml +++ b/modules/monitoring/application/views/scripts/list/notifications.phtml @@ -22,8 +22,7 @@ $formatter = $this->getHelper('MonitoringProperties'); 'notification_start_time' => 'Time' ) ); -?> - +?> @@ -89,4 +88,4 @@ echo $this->paginationControl($notifications, null, null, array('preserve' => $t - \ No newline at end of file + diff --git a/modules/monitoring/application/views/scripts/list/servicegroups.phtml b/modules/monitoring/application/views/scripts/list/servicegroups.phtml deleted file mode 100644 index 952e5dd9d..000000000 --- a/modules/monitoring/application/views/scripts/list/servicegroups.phtml +++ /dev/null @@ -1,5 +0,0 @@ -tabs->render($this); ?> - -
-escape(print_r($this->servicegroups->fetchAll(), 1)) ?>
-
diff --git a/modules/monitoring/application/views/scripts/list/services-compact.phtml b/modules/monitoring/application/views/scripts/list/services-compact.phtml index 93486257a..1ce5a87a5 100644 --- a/modules/monitoring/application/views/scripts/list/services-compact.phtml +++ b/modules/monitoring/application/views/scripts/list/services-compact.phtml @@ -11,29 +11,6 @@ $trimArea = $this->getHelper('Trim'); - -
- Sort by formSelect( - 'sort', - $this->sort, - array('class' => 'autosubmit'), - array( - 'service_severity' => 'Severity', - 'service_last_state_change' => 'Last state change', - 'service_last_time_unknown' => 'Last UNKNOWN', - 'service_last_time_critical' => 'Last CRITICAL', - 'service_last_time_warning' => 'Last WARNING', - 'service_last_time_ok' => 'Last OK', - 'service_description' => 'Service', - ) - ) ?> - - -
paginationControl($paginator, null, null, array('preserve' => $this->preserve)) ?> @@ -56,14 +33,14 @@ $trimArea = $this->getHelper('Trim'); end(); ?> - diff --git a/modules/monitoring/application/views/scripts/list/services.phtml b/modules/monitoring/application/views/scripts/list/services.phtml index 2fb224e75..2b2ff07e7 100644 --- a/modules/monitoring/application/views/scripts/list/services.phtml +++ b/modules/monitoring/application/views/scripts/list/services.phtml @@ -33,7 +33,6 @@ $trimArea = $this->getHelper('Trim'); 'service_description' => 'Service', ) ) ?> - paginationControl($paginator, null, null, array('preserve' => $this->preserve)) ?> @@ -59,14 +58,14 @@ $trimArea = $this->getHelper('Trim'); end(); ?> - diff --git a/modules/monitoring/application/views/scripts/summary/group.phtml b/modules/monitoring/application/views/scripts/summary/group.phtml deleted file mode 100644 index 8c9547dc5..000000000 --- a/modules/monitoring/application/views/scripts/summary/group.phtml +++ /dev/null @@ -1,167 +0,0 @@ -compact): ?> -tabs ?> - -summary)): ?> -There are no such services right now - - -compact && $this->summary instanceof \Zend_Paginator): ?> -paginationControl($this->summary, null, null, array('preserve' => $this->preserve)); ?> - -
+
start(); ?> service_handled && $service->service_state > 0): ?> - - service_acknowledged && !$service->service_in_downtime): ?> + + service_acknowledged && !$service->service_in_downtime): ?> @@ -72,7 +49,7 @@ $trimArea = $this->getHelper('Trim'); - + service_notifications_enabled): ?> @@ -83,7 +60,7 @@ $trimArea = $this->getHelper('Trim'); - end(); ?>
+ end(); ?>
+
start(); ?> service_handled && $service->service_state > 0): ?> - - service_acknowledged && !$service->service_in_downtime): ?> + + service_acknowledged && !$service->service_in_downtime): ?> @@ -75,7 +74,7 @@ $trimArea = $this->getHelper('Trim'); - + service_notifications_enabled): ?> @@ -86,7 +85,7 @@ $trimArea = $this->getHelper('Trim'); - end(); ?>
+ end(); ?>
- - - - - - - - compact): ?> - - - -summary as $row): ?> -critical > 0) { - $class_critical = 'critical'; - $html_critical = $row->critical; - if ($row->critical_ack + $row->critical_dt > 0) { - $html_critical = sprintf( - '%s (%s/%s)', - $row->critical, - $row->critical_ack, - $row->critical_dt - ); - } - if ($name_class === null) $name_class = 'critical'; -} elseif ($row->critical_dt + $row->critical_ack > 0) { - $class_critical = 'critical handled'; - $html_critical = sprintf( - '%s / %s', - $row->critical_ack, - $row->critical_dt - ); - if ($name_class === null) $name_class = 'critical handled'; -} - -if ($row->unknown > 0) { - $class_unknown = 'unknown'; - $html_unknown = $row->unknown; - if ($row->unknown_ack + $row->unknown_dt > 0) { - $html_unknown .= sprintf( - ' (%s/%s)', - $row->unknown, - $row->unknown_ack, - $row->unknown_dt - ); - } - if ($name_class === null) $name_class = 'unknown'; -} elseif ($row->unknown_dt + $row->unknown_ack > 0) { - $class_unknown = 'unknown handled'; - $html_unknown = sprintf( - '%s / %s', - $row->unknown_ack, - $row->unknown_dt - ); - if ($name_class === null) $name_class = 'unknown handled'; -} - -if ($row->warning > 0) { - $class_warning = 'warning'; - $html_warning = $row->warning; - if ($row->warning_ack + $row->warning_dt > 0) { - $html_warning .= sprintf( - ' (%s/%s)', - $row->warning, - $row->warning_ack, - $row->warning_dt - ); - } - if ($name_class === null) $name_class = 'warning'; -} elseif ($row->warning_dt + $row->warning_ack > 0) { - $class_warning = 'warning handled'; - $html_warning = sprintf( - '%s / %s', - $row->warning_ack, - $row->warning_dt - ); - if ($name_class === null) $name_class = 'warning handled'; -} - - -if ($row->ok > 0) { - $class_ok = 'ok'; - if (isset($row->hostgroup_name)) { - $html_ok = $this->qlink($row->ok, 'monitoring/list/services', array( - 'hostgroups' => $row->hostgroup_name - )); - } else { - $html_ok = $this->qlink($row->ok, 'monitoring/list/services', array( - 'servicegroups' => $row->servicegroup_name - )); - } - if ($name_class === null) $name_class = 'ok'; -} - - -if (isset($row->hostgroup_name)) { - if ($name_class === 'ok') { - $name_html = $this->qlink($row->hostgroup_name, 'monitoring/list/services', array( - 'hostgroups' => $row->hostgroup_name - )); - } else { - $name_html = $this->qlink($row->hostgroup_name, 'monitoring/list/services', array( - 'hostgroups' => $row->hostgroup_name, - 'problems' => '1', - 'sort' => 'severity' - )); - } -} else { - if ($name_class === 'ok') { - $name_html = $this->qlink($row->servicegroup_name, 'monitoring/list/services', array( - 'servicegroups' => $row->servicegroup_name - )); - } else { - $name_html = $this->qlink($row->servicegroup_name, 'monitoring/list/services', array( - 'servicegroups' => $row->servicegroup_name, - 'problems' => '1', - 'sort' => 'severity' - )); - } - -} -?> - - - - - - - compact): ?> - - - -
 CriticalUnknownWarningOK
- -compact): ?>
more