From a53f589a6bbb3133656aab4802d5dcef1f4b742f Mon Sep 17 00:00:00 2001 From: Thomas Gelf Date: Tue, 17 Jun 2014 13:48:26 +0000 Subject: [PATCH] monitoring/controllers: filter-related cleanup --- .../controllers/ProcessController.php | 30 +++++++------------ .../controllers/TacticalController.php | 7 ++--- 2 files changed, 13 insertions(+), 24 deletions(-) diff --git a/modules/monitoring/application/controllers/ProcessController.php b/modules/monitoring/application/controllers/ProcessController.php index 71d42fe21..793e91242 100644 --- a/modules/monitoring/application/controllers/ProcessController.php +++ b/modules/monitoring/application/controllers/ProcessController.php @@ -29,21 +29,12 @@ // {{{ICINGA_LICENSE_HEADER}}} use Icinga\Module\Monitoring\Controller as MonitoringController; -use Icinga\Module\Monitoring\Backend; - -use Icinga\Module\Monitoring\DataView\Runtimevariables as RuntimevariablesView; -use Icinga\Module\Monitoring\DataView\Programstatus as ProgramstatusView; -use Icinga\Module\Monitoring\DataView\Runtimesummary as RuntimesummaryView; /** * Display process information and global commands */ class Monitoring_ProcessController extends MonitoringController { - /** - * @var \Icinga\Module\Monitoring\Backend - */ - public $backend; /** * Retrieve backend and hooks for this controller * @@ -51,7 +42,6 @@ class Monitoring_ProcessController extends MonitoringController */ public function init() { - $this->backend = Backend::createBackend($this->_getParam('backend')); $this->getTabs()->add('info', array( 'title' => 'Process Info', 'url' =>'monitoring/process/info' @@ -66,9 +56,10 @@ class Monitoring_ProcessController extends MonitoringController $this->getTabs()->activate('info'); $this->setAutorefreshInterval(10); - $this->view->programstatus = ProgramstatusView::fromRequest( - $this->_request - )->getQuery()->fetchRow(); + // TODO: This one is broken right now, doublecheck default columns + $this->view->programstatus = $this->backend->select() + ->from('programstatus') + ->getQuery()->fetchRow(); $this->view->backendName = $this->backend->getDefaultBackendName(); } @@ -77,14 +68,13 @@ class Monitoring_ProcessController extends MonitoringController { $this->getTabs()->activate('performance'); $this->setAutorefreshInterval(10); - $this->view->runtimevariables = (object) RuntimevariablesView::fromRequest( - $this->_request, - array('varname', 'varvalue') - )->getQuery()->fetchPairs(); + $this->view->runtimevariables = (object) $this->backend->select() + ->from('runtimevariables', array('varname', 'varvalue')) + ->getQuery()->fetchPairs(); - $this->view->checkperformance = $query = RuntimesummaryView::fromRequest( - $this->_request - )->getQuery()->fetchAll(); + $this->view->checkperformance = $this->backend->select() + ->from('runtimesummary') + ->getQuery()->fetchAll(); } } diff --git a/modules/monitoring/application/controllers/TacticalController.php b/modules/monitoring/application/controllers/TacticalController.php index 990a1e0af..2c99e6d65 100644 --- a/modules/monitoring/application/controllers/TacticalController.php +++ b/modules/monitoring/application/controllers/TacticalController.php @@ -3,7 +3,6 @@ // {{{ICINGA_LICENSE_HEADER}}} use Icinga\Module\Monitoring\Controller as MonitoringController; -use Icinga\Module\Monitoring\DataView\StatusSummary; use Icinga\Web\Url; class Monitoring_TacticalController extends MonitoringController @@ -14,12 +13,12 @@ class Monitoring_TacticalController extends MonitoringController 'tactical_overview', array( 'title' => 'Tactical Overview', - 'url' => Url::fromPath('monitoring/tactical') + 'url' => Url::fromRequest() ) )->activate('tactical_overview'); - $this->view->statusSummary = StatusSummary::fromRequest( - $this->_request, + $this->view->statusSummary = $this->backend->select()->from( + 'statusSummary', array( 'hosts_up', 'hosts_pending',