monitoring: Support host and service display_name in the EventHistoryQuery

This adds two left joins to the query when selecting host_display_name and service_display_name.
If performance suffers badly, we have to evaluate whether to support the display_name column for displaying
the host and service name in the eventhistory overview.

refs #7843
This commit is contained in:
Eric Lippmann 2015-01-21 10:24:24 +01:00
parent 1bba0b3d0f
commit aa976c4198

View File

@ -33,6 +33,12 @@ class EventHistoryQuery extends IdoQuery
'hostgroups' => array( 'hostgroups' => array(
'hostgroup' => 'hgo.name1 COLLATE latin1_general_ci', 'hostgroup' => 'hgo.name1 COLLATE latin1_general_ci',
), ),
'hosts' => array(
'host_display_name' => 'h.display_name'
),
'services' => array(
'service_display_name' => 's.display_name'
)
); );
protected $useSubqueryCount = true; protected $useSubqueryCount = true;
@ -114,4 +120,24 @@ class EventHistoryQuery extends IdoQuery
); );
return $this; return $this;
} }
protected function joinHosts()
{
$this->select->joinLeft(
array('h' => $this->prefix . 'hosts'),
'h.host_object_id = eho.object_id',
array()
);
return $this;
}
protected function joinServices()
{
$this->select->joinLeft(
array('s' => $this->prefix . 'services'),
's.service_object_id = eho.object_id',
array()
);
return $this;
}
} }