monitoring: Support host and service display_name in the DowntimeQuery
refs #7843
This commit is contained in:
parent
d528ddc641
commit
85aa447516
|
@ -28,6 +28,12 @@ class DowntimeQuery extends IdoQuery
|
|||
'downtime_host_state' => 'CASE WHEN hs.has_been_checked = 0 OR hs.has_been_checked IS NULL THEN 99 ELSE hs.current_state END',
|
||||
'downtime_service_state' => 'CASE WHEN ss.has_been_checked = 0 OR ss.has_been_checked IS NULL THEN 99 ELSE ss.current_state END'
|
||||
),
|
||||
'hosts' => array(
|
||||
'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'
|
||||
)
|
||||
);
|
||||
|
||||
protected function joinBaseTables()
|
||||
|
@ -58,4 +64,29 @@ class DowntimeQuery extends IdoQuery
|
|||
);
|
||||
$this->joinedVirtualTables = array('downtime' => true);
|
||||
}
|
||||
|
||||
protected function joinHosts()
|
||||
{
|
||||
$this->select->joinLeft(
|
||||
array('h' => $this->prefix . 'hosts'),
|
||||
'h.host_object_id = ho.object_id',
|
||||
array()
|
||||
);
|
||||
return $this;
|
||||
}
|
||||
|
||||
protected function joinServices()
|
||||
{
|
||||
$this->select->joinLeft(
|
||||
array('s' => $this->prefix . 'services'),
|
||||
's.service_object_id = so.object_id',
|
||||
array()
|
||||
);
|
||||
$this->select->joinLeft(
|
||||
array('sh' => $this->prefix . 'hosts'),
|
||||
'sh.host_object_id = s.host_object_id',
|
||||
array()
|
||||
);
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue