From 23daa392052cb8da3eb39ecfccaeb1f0ce117b4d Mon Sep 17 00:00:00 2001 From: Thomas Gelf Date: Tue, 4 Mar 2014 12:59:26 +0000 Subject: [PATCH] Ugly temporary fix for Monitoring\Object problems --- .../library/Monitoring/Object/AbstractObject.php | 14 +++++++++++++- .../monitoring/library/Monitoring/Object/Host.php | 5 +++++ .../library/Monitoring/Object/Service.php | 7 +++++++ 3 files changed, 25 insertions(+), 1 deletion(-) diff --git a/modules/monitoring/library/Monitoring/Object/AbstractObject.php b/modules/monitoring/library/Monitoring/Object/AbstractObject.php index 4a4b0489c..5c09a401a 100644 --- a/modules/monitoring/library/Monitoring/Object/AbstractObject.php +++ b/modules/monitoring/library/Monitoring/Object/AbstractObject.php @@ -42,6 +42,18 @@ abstract class AbstractObject public function fetchComments() { + // WTF??? + $query = Comment::fromParams(array('backend' => null), array( + 'comment_timestamp', + 'comment_author', + 'comment_data', + 'comment_type', + ))->getQuery(); + $query->where('comment_objecttype_id', $this->type); + $this->applyObjectFilter($query); + $this->comments = $query->fetchAll(); + return $this; + $this->comments = Comment::fromRequest( $this->request, array( @@ -52,7 +64,7 @@ abstract class AbstractObject 'comment_type', ) )->getQuery() - ->where('comment_objecttype_id', 1) + //->where('comment_objecttype_id', 1) ->fetchAll(); diff --git a/modules/monitoring/library/Monitoring/Object/Host.php b/modules/monitoring/library/Monitoring/Object/Host.php index bbb5d35ac..6c12323f5 100644 --- a/modules/monitoring/library/Monitoring/Object/Host.php +++ b/modules/monitoring/library/Monitoring/Object/Host.php @@ -3,6 +3,7 @@ namespace Icinga\Module\Monitoring\Object; use Icinga\Module\Monitoring\DataView\HostStatus; +use Icinga\Data\Db\Query; class Host extends AbstractObject { @@ -11,6 +12,10 @@ class Host extends AbstractObject public $prefix = 'host_'; private $view = null; + protected function applyObjectFilter(Query $query) + { + return $query->where('host_name', $this->host_name); + } public function populate() { diff --git a/modules/monitoring/library/Monitoring/Object/Service.php b/modules/monitoring/library/Monitoring/Object/Service.php index 73d0bab93..1c5835b15 100644 --- a/modules/monitoring/library/Monitoring/Object/Service.php +++ b/modules/monitoring/library/Monitoring/Object/Service.php @@ -3,6 +3,7 @@ namespace Icinga\Module\Monitoring\Object; use Icinga\Module\Monitoring\DataView\ServiceStatus; +use Icinga\Data\Db\Query; class Service extends AbstractObject { @@ -11,6 +12,12 @@ class Service extends AbstractObject public $prefix = 'service_'; private $view = null; + protected function applyObjectFilter(Query $query) + { + return $query->where('service_host_name', $this->host_name) + ->where('service_description', $this->service_description); + } + public function populate() { $this->fetchComments()