From 18b933679cad00abdb4f79afa6591b6e59215047 Mon Sep 17 00:00:00 2001 From: Johannes Meyer Date: Fri, 12 Jul 2019 11:46:34 +0200 Subject: [PATCH 1/4] monitoring/list/hosts: Make overdue/unreachable hosts better visible refs #3212 --- .../application/controllers/ListController.php | 3 ++- .../application/views/scripts/list/hosts.phtml | 13 ++++++++++--- modules/monitoring/public/css/tables.less | 4 ++++ 3 files changed, 16 insertions(+), 4 deletions(-) diff --git a/modules/monitoring/application/controllers/ListController.php b/modules/monitoring/application/controllers/ListController.php index c0d8ad03b..56d620523 100644 --- a/modules/monitoring/application/controllers/ListController.php +++ b/modules/monitoring/application/controllers/ListController.php @@ -77,7 +77,8 @@ class ListController extends Controller 'host_notifications_enabled', 'host_active_checks_enabled', 'host_passive_checks_enabled', - 'host_check_command' + 'host_check_command', + 'host_next_update' ), $this->addColumns())); $this->applyRestriction('monitoring/filter/objects', $hosts); diff --git a/modules/monitoring/application/views/scripts/list/hosts.phtml b/modules/monitoring/application/views/scripts/list/hosts.phtml index e00038bf6..4f5cd0ea5 100644 --- a/modules/monitoring/application/views/scripts/list/hosts.phtml +++ b/modules/monitoring/application/views/scripts/list/hosts.phtml @@ -1,4 +1,5 @@ compact): ?> @@ -25,10 +26,16 @@ if (! $this->compact): ?> peekAhead($this->compact) as $host): $hostStateName = Host::getStateText($host->host_state); - $hostLink = $this->href('monitoring/host/show', array('host' => $host->host_name)); ?> - + $hostLink = $this->href('monitoring/host/show', array('host' => $host->host_name)); + $hostCheckOverdue = $host->host_next_update < time();?> + > -
host_state, true) ?>
+
+ + icon('clock', sprintf($this->translate('Overdue %s'), DateFormatter::timeSince($host->host_next_update))) ?> + + host_state, true) ?> +
host_state !== 99): ?>
timeSince($host->host_last_state_change, $this->compact) ?> diff --git a/modules/monitoring/public/css/tables.less b/modules/monitoring/public/css/tables.less index 96e1688d1..112393280 100644 --- a/modules/monitoring/public/css/tables.less +++ b/modules/monitoring/public/css/tables.less @@ -240,6 +240,10 @@ background-color: @tr-hover-color; cursor: pointer; } + + tr[href].state-outdated:not(:hover):not(.active) td:not(.state-col) { + opacity: 0.7; + } } // Event history From 5ead593fa725b96587c8c878b31a7a0c2dbb20be Mon Sep 17 00:00:00 2001 From: Johannes Meyer Date: Fri, 12 Jul 2019 11:47:13 +0200 Subject: [PATCH 2/4] monitoring/list/services: Make overdue/unreachable services better visible refs #3212 --- .../application/controllers/HostController.php | 3 ++- .../application/controllers/ListController.php | 3 ++- .../application/views/scripts/list/services.phtml | 13 ++++++++++--- 3 files changed, 14 insertions(+), 5 deletions(-) diff --git a/modules/monitoring/application/controllers/HostController.php b/modules/monitoring/application/controllers/HostController.php index 147f684df..94f1a60b8 100644 --- a/modules/monitoring/application/controllers/HostController.php +++ b/modules/monitoring/application/controllers/HostController.php @@ -103,7 +103,8 @@ class HostController extends MonitoredObjectController 'service_passive_checks_enabled', 'current_check_attempt' => 'service_current_check_attempt', 'max_check_attempts' => 'service_max_check_attempts', - 'service_check_command' + 'service_check_command', + 'service_next_update' )); $this->applyRestriction('monitoring/filter/objects', $query); $this->view->services = $query->where('host_name', $this->object->getName()); diff --git a/modules/monitoring/application/controllers/ListController.php b/modules/monitoring/application/controllers/ListController.php index 56d620523..b9c71777e 100644 --- a/modules/monitoring/application/controllers/ListController.php +++ b/modules/monitoring/application/controllers/ListController.php @@ -159,7 +159,8 @@ class ListController extends Controller 'service_notifications_enabled', 'service_active_checks_enabled', 'service_passive_checks_enabled', - 'service_check_command' + 'service_check_command', + 'service_next_update' ), $this->addColumns())); $this->applyRestriction('monitoring/filter/objects', $services); diff --git a/modules/monitoring/application/views/scripts/list/services.phtml b/modules/monitoring/application/views/scripts/list/services.phtml index 25a18781a..7deacaf59 100644 --- a/modules/monitoring/application/views/scripts/list/services.phtml +++ b/modules/monitoring/application/views/scripts/list/services.phtml @@ -1,4 +1,5 @@ compact): ?> 'host' => $service->host_name, ) ); - $serviceStateName = Service::getStateText($service->service_state); ?> - + $serviceStateName = Service::getStateText($service->service_state); + $serviceCheckOverdue = $service->service_next_update < time(); ?> + > -
service_state, true) ?>
+
+ + icon('clock', sprintf($this->translate('Overdue %s'), DateFormatter::timeSince($service->service_next_update))) ?> + + service_state, true) ?> +
service_state !== 99): ?>
timeSince($service->service_last_state_change, $this->compact) ?> From 44f63576d10ddb0adeaa71d114bca88ffa3dd03e Mon Sep 17 00:00:00 2001 From: Johannes Meyer Date: Thu, 18 Jul 2019 13:17:24 +0200 Subject: [PATCH 3/4] HoststatusQuery: Add `latency` to next_update calculation.. ..and double the entire result refs #3212 --- .../Monitoring/Backend/Ido/Query/HoststatusQuery.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/modules/monitoring/library/Monitoring/Backend/Ido/Query/HoststatusQuery.php b/modules/monitoring/library/Monitoring/Backend/Ido/Query/HoststatusQuery.php index 96265944a..4b5bcbc40 100644 --- a/modules/monitoring/library/Monitoring/Backend/Ido/Query/HoststatusQuery.php +++ b/modules/monitoring/library/Monitoring/Backend/Ido/Query/HoststatusQuery.php @@ -98,14 +98,14 @@ class HoststatusQuery extends IdoQuery NULL ELSE UNIX_TIMESTAMP(hs.last_check) - + CASE WHEN + + (CASE WHEN COALESCE(hs.current_state, 0) > 0 AND hs.state_type = 0 THEN hs.retry_check_interval ELSE hs.normal_check_interval - END * 60 * 2 - + CEIL(hs.execution_time) + END * 60 + + CEIL(hs.execution_time) + CEIL(hs.latency)) * 2 END', 'host_no_more_notifications' => 'hs.no_more_notifications', 'host_normal_check_interval' => 'hs.normal_check_interval', From f32dac7a70dfb0f51277ac022eb470008e47c993 Mon Sep 17 00:00:00 2001 From: Johannes Meyer Date: Thu, 18 Jul 2019 13:18:53 +0200 Subject: [PATCH 4/4] ServicestatusQuery: Add `latency` to next_update calculation.. ..and double the entire result refs #3212 --- .../Monitoring/Backend/Ido/Query/ServicestatusQuery.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/modules/monitoring/library/Monitoring/Backend/Ido/Query/ServicestatusQuery.php b/modules/monitoring/library/Monitoring/Backend/Ido/Query/ServicestatusQuery.php index 0ff2c65c8..d0cc9ec1c 100644 --- a/modules/monitoring/library/Monitoring/Backend/Ido/Query/ServicestatusQuery.php +++ b/modules/monitoring/library/Monitoring/Backend/Ido/Query/ServicestatusQuery.php @@ -204,14 +204,14 @@ class ServicestatusQuery extends IdoQuery NULL ELSE UNIX_TIMESTAMP(ss.last_check) - + CASE WHEN + + (CASE WHEN COALESCE(ss.current_state, 0) > 0 AND ss.state_type = 0 THEN ss.retry_check_interval ELSE ss.normal_check_interval - END * 60 * 2 - + CEIL(ss.execution_time) + END * 60 + + CEIL(ss.execution_time) + CEIL(ss.latency)) * 2 END', 'service_no_more_notifications' => 'ss.no_more_notifications', 'service_normal_check_interval' => 'ss.normal_check_interval',