From d4dc282ac8b12b21110944145c6f962f873f8725 Mon Sep 17 00:00:00 2001 From: Johannes Meyer Date: Mon, 9 Sep 2019 14:42:16 +0200 Subject: [PATCH 1/2] DashboardContainer: Allow to define a priority for dashlets refs #3931 --- library/Icinga/Application/Modules/DashboardContainer.php | 8 ++++++-- library/Icinga/Application/Modules/Module.php | 7 ++++--- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/library/Icinga/Application/Modules/DashboardContainer.php b/library/Icinga/Application/Modules/DashboardContainer.php index 527c1351c..f3c8bc671 100644 --- a/library/Icinga/Application/Modules/DashboardContainer.php +++ b/library/Icinga/Application/Modules/DashboardContainer.php @@ -43,12 +43,16 @@ class DashboardContainer extends NavigationItemContainer * * @param string $name * @param string $url + * @param int $priority * * @return $this */ - public function add($name, $url) + public function add($name, $url, $priority = null) { - $this->dashlets[$name] = $url; + $this->dashlets[$name] = [ + 'url' => $url, + 'priority' => $priority + ]; return $this; } } diff --git a/library/Icinga/Application/Modules/Module.php b/library/Icinga/Application/Modules/Module.php index 735738089..e8350e156 100644 --- a/library/Icinga/Application/Modules/Module.php +++ b/library/Icinga/Application/Modules/Module.php @@ -315,10 +315,11 @@ class Module foreach ($panes as $pane) { /** @var DashboardContainer $pane */ $dashlets = []; - foreach ($pane->getDashlets() as $dashletName => $dashletUrl) { + foreach ($pane->getDashlets() as $dashletName => $dashletConfig) { $dashlets[$dashletName] = [ - 'label' => $this->translate($dashletName), - 'url' => $dashletUrl + 'label' => $this->translate($dashletName), + 'url' => $dashletConfig['url'], + 'priority' => $dashletConfig['priority'] ]; } From d055e43367d83ad177d75af9aab4f1512470f667 Mon Sep 17 00:00:00 2001 From: Johannes Meyer Date: Mon, 9 Sep 2019 14:42:44 +0200 Subject: [PATCH 2/2] monitoring: Define priorities for dashlets refs #3931 --- modules/monitoring/configuration.php | 39 ++++++++++++++++++---------- 1 file changed, 26 insertions(+), 13 deletions(-) diff --git a/modules/monitoring/configuration.php b/modules/monitoring/configuration.php index 5199f0bdc..c2372ef78 100644 --- a/modules/monitoring/configuration.php +++ b/modules/monitoring/configuration.php @@ -295,15 +295,18 @@ $section->add(N_('Monitoring Health'), array( $dashboard = $this->dashboard(N_('Current Incidents'), array('priority' => 50)); $dashboard->add( N_('Service Problems'), - 'monitoring/list/services?service_problem=1&limit=10&sort=service_severity' + 'monitoring/list/services?service_problem=1&limit=10&sort=service_severity', + 100 ); $dashboard->add( N_('Recently Recovered Services'), - 'monitoring/list/services?service_state=0&limit=10&sort=service_last_state_change&dir=desc' + 'monitoring/list/services?service_state=0&limit=10&sort=service_last_state_change&dir=desc', + 110 ); $dashboard->add( N_('Host Problems'), - 'monitoring/list/hosts?host_problem=1&sort=host_severity' + 'monitoring/list/hosts?host_problem=1&sort=host_severity', + 120 ); /* @@ -329,19 +332,23 @@ $dashboard->add( $dashboard = $this->dashboard(N_('Overdue'), array('priority' => 70)); $dashboard->add( N_('Late Host Check Results'), - 'monitoring/list/hosts?host_next_updateadd( N_('Late Service Check Results'), - 'monitoring/list/services?service_next_updateadd( N_('Acknowledgements Active For At Least Three Days'), - 'monitoring/list/comments?comment_type=Ack&comment_timestamp<-3 days&sort=comment_timestamp&dir=asc' + 'monitoring/list/comments?comment_type=Ack&comment_timestamp<-3 days&sort=comment_timestamp&dir=asc', + 120 ); $dashboard->add( N_('Downtimes Active For More Than Three Days'), - 'monitoring/list/downtimes?downtime_is_in_effect=1&downtime_scheduled_start<-3%20days&sort=downtime_start&dir=asc' + 'monitoring/list/downtimes?downtime_is_in_effect=1&downtime_scheduled_start<-3%20days&sort=downtime_start&dir=asc', + 130 ); /* @@ -350,27 +357,33 @@ $dashboard->add( $dashboard = $this->dashboard(N_('Muted'), array('priority' => 80)); $dashboard->add( N_('Disabled Service Notifications'), - 'monitoring/list/services?service_notifications_enabled=0&limit=10' + 'monitoring/list/services?service_notifications_enabled=0&limit=10', + 100 ); $dashboard->add( N_('Disabled Host Notifications'), - 'monitoring/list/hosts?host_notifications_enabled=0&limit=10' + 'monitoring/list/hosts?host_notifications_enabled=0&limit=10', + 110 ); $dashboard->add( N_('Disabled Service Checks'), - 'monitoring/list/services?service_active_checks_enabled=0&limit=10' + 'monitoring/list/services?service_active_checks_enabled=0&limit=10', + 120 ); $dashboard->add( N_('Disabled Host Checks'), - 'monitoring/list/hosts?host_active_checks_enabled=0&limit=10' + 'monitoring/list/hosts?host_active_checks_enabled=0&limit=10', + 130 ); $dashboard->add( N_('Acknowledged Problem Services'), - 'monitoring/list/services?service_acknowledgement_type=2&service_problem=1&sort=service_state&limit=10' + 'monitoring/list/services?service_acknowledgement_type=2&service_problem=1&sort=service_state&limit=10', + 140 ); $dashboard->add( N_('Acknowledged Problem Hosts'), - 'monitoring/list/hosts?host_acknowledgement_type=2&host_problem=1&sort=host_severity&limit=10' + 'monitoring/list/hosts?host_acknowledgement_type=2&host_problem=1&sort=host_severity&limit=10', + 150 ); /*