mirror of
https://github.com/Icinga/icingaweb2-module-graphite.git
synced 2026-05-28 04:34:57 -04:00
parent
47195e1108
commit
cdce975c2c
2 changed files with 1 additions and 75 deletions
|
|
@ -40,80 +40,6 @@ class ShowController extends Controller
|
|||
$this->params->shift('r');
|
||||
}
|
||||
|
||||
public function overviewAction()
|
||||
{
|
||||
$this->handleDatasourceToggles();
|
||||
$this->handleGraphParams();
|
||||
// TODO: $max = $query->getMaxValue();
|
||||
|
||||
$this->view->tabs->add('overview', array(
|
||||
'label' => $this->translate('Graphite - Overview'),
|
||||
'url' => $this->getRequest()->getUrl()
|
||||
))->activate('overview');
|
||||
|
||||
$this->view->filterColumn = $this->params->get('filterColumn');
|
||||
$this->view->filterValue = $this->params->get('filterValue');
|
||||
|
||||
$optional = array(null => '- please choose -');
|
||||
$any = array('*' => 'Show any');
|
||||
|
||||
$this->view->templates = array_merge(
|
||||
$optional,
|
||||
$this->templateStore->enumTemplates()
|
||||
);
|
||||
|
||||
if (! $template = $this->template) {
|
||||
return;
|
||||
}
|
||||
|
||||
$varnames = GraphiteUtil::extractVariableNames($template->getFilterString());
|
||||
$varnames = array_combine($varnames, $varnames);
|
||||
|
||||
$this->view->filterColumns = $optional + $varnames;
|
||||
|
||||
if ($this->view->filterColumn) {
|
||||
if (array_key_exists($this->view->filterColumn, $this->view->filterColumns)) {
|
||||
|
||||
$this->view->filterValues = $optional + $any + $this->graphiteWeb->select()
|
||||
->from($template->getFilterString())
|
||||
->listDistinct($this->view->filterColumn);
|
||||
}
|
||||
}
|
||||
|
||||
if (! $this->view->filterColumn || ! $this->view->filterValue) {
|
||||
return;
|
||||
}
|
||||
|
||||
$imgs = array();
|
||||
|
||||
$title = $template->getTitle();
|
||||
if (false === strpos($title, '$')) {
|
||||
$template->setTitle('$hostname');
|
||||
} else {
|
||||
if (false === strpos($title, '$hostname')) {
|
||||
$template->setTitle('$hostname: ' . $template->getTitle());
|
||||
}
|
||||
}
|
||||
|
||||
$query = $this->graphiteWeb->select()->from(
|
||||
$template->getFilterString()
|
||||
)->where($this->view->filterColumn, $this->view->filterValue);
|
||||
|
||||
$view = $this->view;
|
||||
$imgParams = array(
|
||||
'template' => $view->templateName,
|
||||
'start' => $view->start,
|
||||
'width' => $view->width,
|
||||
'height' => $view->height
|
||||
);
|
||||
|
||||
if ($this->view->disabledDatasources) {
|
||||
$imgParams['disabled'] = $this->view->disabledDatasources;
|
||||
}
|
||||
|
||||
$view->images = $query->getWrappedImageLinks($template, $imgParams);
|
||||
}
|
||||
|
||||
public function graphAction()
|
||||
{
|
||||
$template = $this->loadTemplate();
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
/** @var \Icinga\Application\Modules\Module $this */
|
||||
|
||||
/** @var \Icinga\Application\Modules\MenuItemContainer $section */
|
||||
$section = $this->menuSection(N_('Graphite'), ['icon' => 'chart-area'])->setUrl('graphite/show/overview');
|
||||
$section = $this->menuSection(N_('Graphite'), ['icon' => 'chart-area']);
|
||||
$section->add(N_('Hosts'), ['url' => 'graphite/list/hosts']);
|
||||
$section->add(N_('Services'), ['url' => 'graphite/list/services']);
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue