From 3a1afb3511ba04b670f243853ac5e36b2d7509f2 Mon Sep 17 00:00:00 2001 From: Eric Lippmann Date: Thu, 27 Jul 2017 15:03:12 +0200 Subject: [PATCH] Don't call UNIX_TIMESTAMP when sorting by service_last_state_change Else possible indices can't be used. --- .../Monitoring/Backend/Ido/Query/ServicestatusQuery.php | 1 + .../monitoring/library/Monitoring/DataView/Servicestatus.php | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/modules/monitoring/library/Monitoring/Backend/Ido/Query/ServicestatusQuery.php b/modules/monitoring/library/Monitoring/Backend/Ido/Query/ServicestatusQuery.php index 3aadb1047..37f87eed3 100644 --- a/modules/monitoring/library/Monitoring/Backend/Ido/Query/ServicestatusQuery.php +++ b/modules/monitoring/library/Monitoring/Backend/Ido/Query/ServicestatusQuery.php @@ -192,6 +192,7 @@ class ServicestatusQuery extends IdoQuery 'service_last_hard_state_change' => 'UNIX_TIMESTAMP(ss.last_hard_state_change)', 'service_last_notification' => 'UNIX_TIMESTAMP(ss.last_notification)', 'service_last_state_change' => 'UNIX_TIMESTAMP(ss.last_state_change)', + 'service_last_state_change_ts' => 'ss.last_state_change', 'service_last_time_critical' => 'ss.last_time_critical', 'service_last_time_ok' => 'ss.last_time_ok', 'service_last_time_unknown' => 'ss.last_time_unknown', diff --git a/modules/monitoring/library/Monitoring/DataView/Servicestatus.php b/modules/monitoring/library/Monitoring/DataView/Servicestatus.php index be6aab849..a5154c4ea 100644 --- a/modules/monitoring/library/Monitoring/DataView/Servicestatus.php +++ b/modules/monitoring/library/Monitoring/DataView/Servicestatus.php @@ -73,6 +73,7 @@ class ServiceStatus extends DataView 'service_last_hard_state_change', 'service_last_notification', 'service_last_state_change', + 'service_last_state_change_ts', 'service_last_time_critical', 'service_last_time_ok', 'service_last_time_unknown', @@ -122,6 +123,9 @@ class ServiceStatus extends DataView 'order' => self::SORT_DESC ), 'service_last_state_change' => array( + 'columns' => array( + 'service_last_state_change_ts' + ), 'order' => self::SORT_DESC ), 'host_severity' => array(