Improve Eventgrid performance by limititing query time range, and only querying for hosts or services as requested in the form.
This commit is contained in:
parent
b69c9491ae
commit
e7d117e1b6
|
@ -361,13 +361,16 @@ class ListController extends Controller
|
|||
);
|
||||
$orientationBox->applyRequest($this->getRequest());
|
||||
*/
|
||||
$objectType = $this->getParam('objecttype', 'services');
|
||||
$from = date('c', $this->getParam('from', strtotime('midnight 3 months ago')));
|
||||
$query = $this->backend->select()->from(
|
||||
'eventgrid',
|
||||
'eventgrid' . $objectType,
|
||||
array('day', $form->getValue('state'))
|
||||
);
|
||||
$this->params->remove(array('objecttype', 'from', 'to', 'state', 'btn_submit'));
|
||||
$this->view->filter = Filter::fromQuerystring((string) $this->params);
|
||||
$query->applyFilter($this->view->filter);
|
||||
$query->applyFilter(Filter::fromQuerystring('timestamp >= ' . $from));
|
||||
$this->applyRestriction('monitoring/filter/objects', $query);
|
||||
$this->view->summary = $query;
|
||||
$this->view->column = $form->getValue('state');
|
||||
|
|
|
@ -0,0 +1,16 @@
|
|||
<?php
|
||||
|
||||
namespace Icinga\Module\Monitoring\Backend\Ido\Query;
|
||||
|
||||
class EventgridhostsQuery extends EventgridQuery
|
||||
{
|
||||
|
||||
/**
|
||||
* Join history related columns and tables, hosts only
|
||||
*/
|
||||
protected function joinHistory()
|
||||
{
|
||||
$this->fetchHistoryColumns = true;
|
||||
$this->requireVirtualTable('hosts');
|
||||
}
|
||||
}
|
|
@ -0,0 +1,16 @@
|
|||
<?php
|
||||
|
||||
namespace Icinga\Module\Monitoring\Backend\Ido\Query;
|
||||
|
||||
class EventgridservicesQuery extends EventgridQuery
|
||||
{
|
||||
|
||||
/**
|
||||
* Join history related columns and tables, services only
|
||||
*/
|
||||
protected function joinHistory()
|
||||
{
|
||||
$this->fetchHistoryColumns = true;
|
||||
$this->requireVirtualTable('services');
|
||||
}
|
||||
}
|
|
@ -0,0 +1,7 @@
|
|||
<?php
|
||||
|
||||
namespace Icinga\Module\Monitoring\DataView;
|
||||
|
||||
class Eventgridhosts extends Eventgrid
|
||||
{
|
||||
}
|
|
@ -0,0 +1,7 @@
|
|||
<?php
|
||||
|
||||
namespace Icinga\Module\Monitoring\DataView;
|
||||
|
||||
class Eventgridservices extends Eventgrid
|
||||
{
|
||||
}
|
Loading…
Reference in New Issue