Skip to content

Commit

Permalink
Fetch object comments by host_name and service_description
Browse files Browse the repository at this point in the history
refs #8614
  • Loading branch information
lippserd committed Mar 12, 2015
1 parent 29b5e4f commit 7156bd7
Showing 1 changed file with 12 additions and 7 deletions.
19 changes: 12 additions & 7 deletions modules/monitoring/library/Monitoring/Object/MonitoredObject.php
Expand Up @@ -253,10 +253,13 @@ public function fetchComments()
'type' => 'comment_type',
))
->where('comment_type', array('comment', 'ack'))
->where('comment_objecttype', $this->type)
->where('comment_host', $this->host_name);
->where('comment_objecttype', $this->type);
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();
return $this;
Expand Down Expand Up @@ -387,8 +390,9 @@ public function fetchContacts()
'contact_pager',
));
if ($this->type === self::TYPE_SERVICE) {
$contacts->where('service_host_name', $this->host_name);
$contacts->where('service_description', $this->service_description);
$contacts
->where('service_host_name', $this->host_name)
->where('service_description', $this->service_description);
} else {
$contacts->where('host_name', $this->host_name);
}
Expand Down Expand Up @@ -430,8 +434,9 @@ public function fetchContactgroups()
'contactgroup_alias'
));
if ($this->type === self::TYPE_SERVICE) {
$contactsGroups->where('service_host_name', $this->host_name);
$contactsGroups->where('service_description', $this->service_description);
$contactsGroups
->where('service_host_name', $this->host_name)
->where('service_description', $this->service_description);
} else {
$contactsGroups->where('host_name', $this->host_name);
}
Expand Down

0 comments on commit 7156bd7

Please sign in to comment.