From e7776d08a9d124927488363b5a69124271fc5695 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 host_last_state_change Else possible indices can't be used. --- .../library/Monitoring/Backend/Ido/Query/HoststatusQuery.php | 1 + modules/monitoring/library/Monitoring/DataView/Hoststatus.php | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/modules/monitoring/library/Monitoring/Backend/Ido/Query/HoststatusQuery.php b/modules/monitoring/library/Monitoring/Backend/Ido/Query/HoststatusQuery.php index b9343738d..404dc75d3 100644 --- a/modules/monitoring/library/Monitoring/Backend/Ido/Query/HoststatusQuery.php +++ b/modules/monitoring/library/Monitoring/Backend/Ido/Query/HoststatusQuery.php @@ -78,6 +78,7 @@ class HoststatusQuery extends IdoQuery 'host_last_hard_state_change' => 'UNIX_TIMESTAMP(hs.last_hard_state_change)', 'host_last_notification' => 'UNIX_TIMESTAMP(hs.last_notification)', 'host_last_state_change' => 'UNIX_TIMESTAMP(hs.last_state_change)', + 'host_last_state_change_ts' => 'hs.last_state_change', 'host_last_time_down' => 'UNIX_TIMESTAMP(hs.last_time_down)', 'host_last_time_unreachable' => 'UNIX_TIMESTAMP(hs.last_time_unreachable)', 'host_last_time_up' => 'UNIX_TIMESTAMP(hs.last_time_up)', diff --git a/modules/monitoring/library/Monitoring/DataView/Hoststatus.php b/modules/monitoring/library/Monitoring/DataView/Hoststatus.php index 8f02b70ac..f610796d0 100644 --- a/modules/monitoring/library/Monitoring/DataView/Hoststatus.php +++ b/modules/monitoring/library/Monitoring/DataView/Hoststatus.php @@ -40,6 +40,7 @@ class HostStatus extends DataView 'host_last_check', 'host_last_notification', 'host_last_state_change', + 'host_last_state_change_ts', 'host_long_output', 'host_max_check_attempts', 'host_modified_host_attributes', @@ -119,6 +120,9 @@ class HostStatus extends DataView 'order' => self::SORT_ASC ), 'host_last_state_change' => array( + 'columns' => array( + 'host_last_state_change_ts' + ), 'order' => self::SORT_DESC ) );