From f741bc01f33552c597b680547f03a46660776272 Mon Sep 17 00:00:00 2001 From: Thomas Gelf Date: Thu, 17 Apr 2014 16:41:10 +0000 Subject: [PATCH] We need stricter control over Monitoring Object queries * fromRequest-generated ones are sometimes buggy and sometimes slow * this is just a temporary quickfix for the worst problems --- .../Monitoring/Object/AbstractObject.php | 31 ++++++++++++++++++- 1 file changed, 30 insertions(+), 1 deletion(-) diff --git a/modules/monitoring/library/Monitoring/Object/AbstractObject.php b/modules/monitoring/library/Monitoring/Object/AbstractObject.php index ba046decb..23417f034 100644 --- a/modules/monitoring/library/Monitoring/Object/AbstractObject.php +++ b/modules/monitoring/library/Monitoring/Object/AbstractObject.php @@ -142,6 +142,7 @@ abstract class AbstractObject public function fetchContacts() { +/* $query = Contact::fromRequest( $this->request, array( @@ -152,6 +153,21 @@ abstract class AbstractObject ) )->getQuery() ->where('host_name', $this->host_name); +*/ + + $query = Contact::fromParams(array('backend' => null), array( + 'contact_name', + 'contact_alias', + 'contact_email', + 'contact_pager', + ))->getQuery(); + + if ($this->type === 'service') { + $query->where('service_host_name', $this->host_name); + $query->where('service_description', $this->service_description); + } else { + $query->where('host_name', $this->host_name); + } $this->contacts = $query->fetchAll(); return $this; @@ -173,6 +189,19 @@ abstract class AbstractObject public function fetchContactgroups() { + + $query = Contactgroup::fromParams(array('backend' => null), array( + 'contactgroup_name', + 'contactgroup_alias' + ))->getQuery(); + + if ($this->type === 'service') { + $query->where('service_host_name', $this->host_name); + $query->where('service_description', $this->service_description); + } else { + $query->where('host_name', $this->host_name); + } +/* $query = Contactgroup::fromRequest( $this->request, array( @@ -180,7 +209,7 @@ abstract class AbstractObject 'contactgroup_alias' ) )->getQuery(); - +*/ $this->contactgroups = $query->fetchAll(); return $this;