From 7156bd7dfb24526d7d4cfb82030b1abd367cf621 Mon Sep 17 00:00:00 2001 From: Eric Lippmann Date: Thu, 12 Mar 2015 16:39:20 +0100 Subject: [PATCH] Fetch object comments by host_name and service_description refs #8614 --- .../Monitoring/Object/MonitoredObject.php | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/modules/monitoring/library/Monitoring/Object/MonitoredObject.php b/modules/monitoring/library/Monitoring/Object/MonitoredObject.php index 38053f5a2..f50d7249c 100644 --- a/modules/monitoring/library/Monitoring/Object/MonitoredObject.php +++ b/modules/monitoring/library/Monitoring/Object/MonitoredObject.php @@ -253,10 +253,13 @@ abstract class MonitoredObject implements Filterable '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; @@ -387,8 +390,9 @@ abstract class MonitoredObject implements Filterable '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); } @@ -430,8 +434,9 @@ abstract class MonitoredObject implements Filterable '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); }