mirror of
https://github.com/Icinga/icingaweb2-module-graphite.git
synced 2026-03-16 15:42:24 -04:00
48 lines
1.1 KiB
PHP
48 lines
1.1 KiB
PHP
<?php
|
|
|
|
namespace Icinga\Module\Graphite\Web\Widget\Graphs;
|
|
|
|
use Icinga\Module\Graphite\GraphiteQuery;
|
|
use Icinga\Module\Graphite\GraphTemplate;
|
|
use Icinga\Module\Graphite\Web\Widget\Graphs;
|
|
|
|
class Service extends Graphs
|
|
{
|
|
/**
|
|
* The host to render the graphs of
|
|
*
|
|
* @var string
|
|
*/
|
|
protected $host;
|
|
|
|
/**
|
|
* The service to render the graphs of
|
|
*
|
|
* @var string
|
|
*/
|
|
protected $service;
|
|
|
|
/**
|
|
* Constructor
|
|
*
|
|
* @param string $host The host to render the graphs of
|
|
* @param string $service The service to render the graphs of
|
|
*/
|
|
public function __construct($host, $service)
|
|
{
|
|
$this->host = $host;
|
|
$this->service = $service;
|
|
}
|
|
|
|
protected function filterGraphiteQuery(GraphiteQuery $query)
|
|
{
|
|
return $query
|
|
->where('hostname', $this->host)
|
|
->where('service', $this->service);
|
|
}
|
|
|
|
protected function includeTemplate(GraphTemplate $template)
|
|
{
|
|
return strpos($template->getFilterString(), '$service') !== false;
|
|
}
|
|
}
|