monitoring/controllers: filter-related cleanup

This commit is contained in:
Thomas Gelf 2014-06-17 13:48:26 +00:00
parent 1a91f0369e
commit a53f589a6b
2 changed files with 13 additions and 24 deletions

View File

@ -29,21 +29,12 @@
// {{{ICINGA_LICENSE_HEADER}}} // {{{ICINGA_LICENSE_HEADER}}}
use Icinga\Module\Monitoring\Controller as MonitoringController; 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 * Display process information and global commands
*/ */
class Monitoring_ProcessController extends MonitoringController class Monitoring_ProcessController extends MonitoringController
{ {
/**
* @var \Icinga\Module\Monitoring\Backend
*/
public $backend;
/** /**
* Retrieve backend and hooks for this controller * Retrieve backend and hooks for this controller
* *
@ -51,7 +42,6 @@ class Monitoring_ProcessController extends MonitoringController
*/ */
public function init() public function init()
{ {
$this->backend = Backend::createBackend($this->_getParam('backend'));
$this->getTabs()->add('info', array( $this->getTabs()->add('info', array(
'title' => 'Process Info', 'title' => 'Process Info',
'url' =>'monitoring/process/info' 'url' =>'monitoring/process/info'
@ -66,9 +56,10 @@ class Monitoring_ProcessController extends MonitoringController
$this->getTabs()->activate('info'); $this->getTabs()->activate('info');
$this->setAutorefreshInterval(10); $this->setAutorefreshInterval(10);
$this->view->programstatus = ProgramstatusView::fromRequest( // TODO: This one is broken right now, doublecheck default columns
$this->_request $this->view->programstatus = $this->backend->select()
)->getQuery()->fetchRow(); ->from('programstatus')
->getQuery()->fetchRow();
$this->view->backendName = $this->backend->getDefaultBackendName(); $this->view->backendName = $this->backend->getDefaultBackendName();
} }
@ -77,14 +68,13 @@ class Monitoring_ProcessController extends MonitoringController
{ {
$this->getTabs()->activate('performance'); $this->getTabs()->activate('performance');
$this->setAutorefreshInterval(10); $this->setAutorefreshInterval(10);
$this->view->runtimevariables = (object) RuntimevariablesView::fromRequest( $this->view->runtimevariables = (object) $this->backend->select()
$this->_request, ->from('runtimevariables', array('varname', 'varvalue'))
array('varname', 'varvalue') ->getQuery()->fetchPairs();
)->getQuery()->fetchPairs();
$this->view->checkperformance = $query = RuntimesummaryView::fromRequest( $this->view->checkperformance = $this->backend->select()
$this->_request ->from('runtimesummary')
)->getQuery()->fetchAll(); ->getQuery()->fetchAll();
} }
} }

View File

@ -3,7 +3,6 @@
// {{{ICINGA_LICENSE_HEADER}}} // {{{ICINGA_LICENSE_HEADER}}}
use Icinga\Module\Monitoring\Controller as MonitoringController; use Icinga\Module\Monitoring\Controller as MonitoringController;
use Icinga\Module\Monitoring\DataView\StatusSummary;
use Icinga\Web\Url; use Icinga\Web\Url;
class Monitoring_TacticalController extends MonitoringController class Monitoring_TacticalController extends MonitoringController
@ -14,12 +13,12 @@ class Monitoring_TacticalController extends MonitoringController
'tactical_overview', 'tactical_overview',
array( array(
'title' => 'Tactical Overview', 'title' => 'Tactical Overview',
'url' => Url::fromPath('monitoring/tactical') 'url' => Url::fromRequest()
) )
)->activate('tactical_overview'); )->activate('tactical_overview');
$this->view->statusSummary = StatusSummary::fromRequest( $this->view->statusSummary = $this->backend->select()->from(
$this->_request, 'statusSummary',
array( array(
'hosts_up', 'hosts_up',
'hosts_pending', 'hosts_pending',