icingaweb2-module-graphite/library/Graphite/Web/Widget/Graphs/Service.php
2018-01-12 11:40:17 +01:00

66 lines
1.8 KiB
PHP

<?php
namespace Icinga\Module\Graphite\Web\Widget\Graphs;
use Icinga\Module\Graphite\Graphing\Template;
use Icinga\Module\Graphite\Web\Widget\Graphs;
use Icinga\Web\Url;
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
* @param string $checkCommand The check command of the monitored object we display graphs for
* @param string|null $obscuredCheckCommand The "real" check command (if any) of the monitored object
* we display graphs for
*/
public function __construct($host, $service, $checkCommand, $obscuredCheckCommand)
{
parent::__construct($checkCommand, $obscuredCheckCommand);
$this->host = $host;
$this->service = $service;
}
protected function getImageBaseUrl()
{
return Url::fromPath('graphite/graph/service');
}
protected function getDummyImageBaseUrl()
{
return Url::fromPath('graphite/graph-dummy/service');
}
protected function filterImageUrl(Url $url)
{
return $url->setParam('host.name', $this->host)->setParam('service.name', $this->service);
}
protected function getMonitoredObjectIdentifier()
{
return $this->host . ':' . $this->service;
}
protected function getMonitoredObjectFilter()
{
return ['host.name' => $this->host, 'service.name' => $this->service];
}
}