Fetch object comments by host_name and service_description

refs #8614
This commit is contained in:
Eric Lippmann 2015-03-12 16:39:20 +01:00
parent 29b5e4fd43
commit 7156bd7dfb
1 changed files with 12 additions and 7 deletions

View File

@ -253,10 +253,13 @@ abstract class MonitoredObject implements Filterable
'type' => 'comment_type', 'type' => 'comment_type',
)) ))
->where('comment_type', array('comment', 'ack')) ->where('comment_type', array('comment', 'ack'))
->where('comment_objecttype', $this->type) ->where('comment_objecttype', $this->type);
->where('comment_host', $this->host_name);
if ($this->type === self::TYPE_SERVICE) { if ($this->type === self::TYPE_SERVICE) {
$comments->where('comment_service', $this->service_description); $comments
->where('service_host_name', $this->host_name)
->where('service_description', $this->service_description);
} else {
$comments->where('host_name', $this->host_name);
} }
$this->comments = $comments->getQuery()->fetchAll(); $this->comments = $comments->getQuery()->fetchAll();
return $this; return $this;
@ -387,8 +390,9 @@ abstract class MonitoredObject implements Filterable
'contact_pager', 'contact_pager',
)); ));
if ($this->type === self::TYPE_SERVICE) { if ($this->type === self::TYPE_SERVICE) {
$contacts->where('service_host_name', $this->host_name); $contacts
$contacts->where('service_description', $this->service_description); ->where('service_host_name', $this->host_name)
->where('service_description', $this->service_description);
} else { } else {
$contacts->where('host_name', $this->host_name); $contacts->where('host_name', $this->host_name);
} }
@ -430,8 +434,9 @@ abstract class MonitoredObject implements Filterable
'contactgroup_alias' 'contactgroup_alias'
)); ));
if ($this->type === self::TYPE_SERVICE) { if ($this->type === self::TYPE_SERVICE) {
$contactsGroups->where('service_host_name', $this->host_name); $contactsGroups
$contactsGroups->where('service_description', $this->service_description); ->where('service_host_name', $this->host_name)
->where('service_description', $this->service_description);
} else { } else {
$contactsGroups->where('host_name', $this->host_name); $contactsGroups->where('host_name', $this->host_name);
} }