diff --git a/modules/monitoring/library/Monitoring/Backend/Ido/Query/EventHistoryQuery.php b/modules/monitoring/library/Monitoring/Backend/Ido/Query/EventHistoryQuery.php index e6efb1e45..2896f9536 100644 --- a/modules/monitoring/library/Monitoring/Backend/Ido/Query/EventHistoryQuery.php +++ b/modules/monitoring/library/Monitoring/Backend/Ido/Query/EventHistoryQuery.php @@ -33,7 +33,7 @@ class EventHistoryQuery extends IdoQuery 'hostgroup' => 'hgo.name1 COLLATE latin1_general_ci', ), 'hosts' => array( - 'host_display_name' => 'h.display_name' + 'host_display_name' => 'CASE WHEN sh.display_name IS NOT NULL THEN sh.display_name ELSE h.display_name END' ), 'services' => array( 'service_display_name' => 's.display_name' @@ -137,6 +137,11 @@ class EventHistoryQuery extends IdoQuery 's.service_object_id = eho.object_id', array() ); + $this->select->joinLeft( + array('sh' => $this->prefix . 'hosts'), + 'sh.host_object_id = s.host_object_id', + array() + ); return $this; } }