monitoring: Support host and service display_name in the NotificationQuery

refs 
This commit is contained in:
Eric Lippmann 2015-01-21 15:47:10 +01:00
parent b05316340c
commit d8b1e63231
1 changed files with 40 additions and 9 deletions
modules/monitoring/library/Monitoring/Backend/Ido/Query

View File

@ -26,6 +26,12 @@ class NotificationQuery extends IdoQuery
'acknowledgement_entry_time' => 'UNIX_TIMESTAMP(a.entry_time)',
'acknowledgement_author_name' => 'a.author_name',
'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()
);
}
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;
}
}