monitoring: Support host and service display_name in the NotificationQuery

refs #7843
This commit is contained in:
Eric Lippmann 2015-01-21 15:47:10 +01:00
parent b05316340c
commit d8b1e63231

View File

@ -26,6 +26,12 @@ class NotificationQuery extends IdoQuery
'acknowledgement_entry_time' => 'UNIX_TIMESTAMP(a.entry_time)', 'acknowledgement_entry_time' => 'UNIX_TIMESTAMP(a.entry_time)',
'acknowledgement_author_name' => 'a.author_name', 'acknowledgement_author_name' => 'a.author_name',
'acknowledgement_comment_data' => 'a.comment_data' 'acknowledgement_comment_data' => 'a.comment_data'
),
'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'
) )
); );
@ -100,4 +106,29 @@ class NotificationQuery extends IdoQuery
array() array()
); );
} }
protected function joinHosts()
{
$this->select->joinLeft(
array('h' => $this->prefix . 'hosts'),
'h.host_object_id = o.object_id',
array()
);
return $this;
}
protected function joinServices()
{
$this->select->joinLeft(
array('s' => $this->prefix . 'services'),
's.service_object_id = o.object_id',
array()
);
$this->select->joinLeft(
array('sh' => $this->prefix . 'hosts'),
'sh.host_object_id = s.host_object_id',
array()
);
return $this;
}
} }