From 02d1b17a382e4d042a6188d02ea1f171a150f132 Mon Sep 17 00:00:00 2001 From: Thomas Gelf Date: Tue, 2 Dec 2014 11:35:21 +0100 Subject: [PATCH] BusinessProcess: use new filters --- library/Businessprocess/BusinessProcess.php | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/library/Businessprocess/BusinessProcess.php b/library/Businessprocess/BusinessProcess.php index da85271..37cd849 100644 --- a/library/Businessprocess/BusinessProcess.php +++ b/library/Businessprocess/BusinessProcess.php @@ -2,6 +2,7 @@ namespace Icinga\Module\Businessprocess; +use Icinga\Data\Filter\Filter; use Exception; class BusinessProcess @@ -104,12 +105,16 @@ class BusinessProcess $hostStateColumn = 'host_state'; $serviceStateColumn = 'service_state'; } + $filter = Filter::matchAny(); + foreach ($hostFilter as $host) { + $filter->addFilter(Filter::match('host_name', $host)); + } $hostStatus = $backend->select()->from('hostStatus', array( 'hostname' => 'host_name', 'in_downtime' => 'host_in_downtime', 'ack' => 'host_acknowledged', 'state' => $hostStateColumn - ))->where('host_name', $hostFilter)->getQuery()->fetchAll(); + ))->applyFilter($filter)->getQuery()->fetchAll(); $serviceStatus = $backend->select()->from('serviceStatus', array( 'hostname' => 'host_name', @@ -117,7 +122,7 @@ class BusinessProcess 'in_downtime' => 'service_in_downtime', 'ack' => 'service_acknowledged', 'state' => $serviceStateColumn - ))->where('host_name', $hostFilter)->getQuery()->fetchAll(); + ))->applyFilter($filter)->getQuery()->fetchAll(); foreach ($serviceStatus + $hostStatus as $row) { $key = $row->hostname; @@ -172,6 +177,7 @@ class BusinessProcess public function getRootNodes() { + ksort($this->root_nodes); return $this->root_nodes; }