2017-09-19 11:18:40 -04:00
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
namespace Icinga\Module\Graphite\Web\Widget\Graphs;
|
|
|
|
|
|
2017-09-28 12:56:16 -04:00
|
|
|
use Icinga\Module\Graphite\Graphing\Template;
|
2017-09-19 11:18:40 -04:00
|
|
|
use Icinga\Module\Graphite\Web\Widget\Graphs;
|
2018-06-04 10:03:30 -04:00
|
|
|
use Icinga\Module\Monitoring\Object\Service as MonitoredService;
|
2017-09-21 11:03:05 -04:00
|
|
|
use Icinga\Web\Url;
|
2017-09-19 11:18:40 -04:00
|
|
|
|
|
|
|
|
class Service extends Graphs
|
|
|
|
|
{
|
2022-02-15 03:58:38 -05:00
|
|
|
protected $objectType = 'service';
|
2017-09-19 11:18:40 -04:00
|
|
|
|
|
|
|
|
/**
|
2022-02-15 03:58:38 -05:00
|
|
|
* The service to render the graphs for
|
2017-09-19 11:18:40 -04:00
|
|
|
*
|
2018-06-04 10:03:30 -04:00
|
|
|
* @var MonitoredService
|
2017-09-19 11:18:40 -04:00
|
|
|
*/
|
2022-02-15 03:58:38 -05:00
|
|
|
protected $object;
|
2017-09-19 11:18:40 -04:00
|
|
|
|
2017-09-28 12:56:16 -04:00
|
|
|
protected function getImageBaseUrl()
|
2017-09-19 11:18:40 -04:00
|
|
|
{
|
2017-09-28 12:56:16 -04:00
|
|
|
return Url::fromPath('graphite/graph/service');
|
2017-09-19 11:18:40 -04:00
|
|
|
}
|
|
|
|
|
|
2018-04-06 10:35:02 -04:00
|
|
|
protected function getGraphsListBaseUrl()
|
|
|
|
|
{
|
2018-06-04 10:03:30 -04:00
|
|
|
return Url::fromPath(
|
|
|
|
|
'graphite/list/services',
|
2022-02-15 03:58:38 -05:00
|
|
|
['host' => $this->object->getHost()->getName(), 'service' => $this->object->getName()]
|
2018-06-04 10:03:30 -04:00
|
|
|
);
|
2018-04-06 10:35:02 -04:00
|
|
|
}
|
|
|
|
|
|
2017-09-28 12:56:16 -04:00
|
|
|
protected function filterImageUrl(Url $url)
|
2017-09-19 11:18:40 -04:00
|
|
|
{
|
2018-06-04 10:03:30 -04:00
|
|
|
return $url
|
2022-02-15 03:58:38 -05:00
|
|
|
->setParam('host.name', $this->object->getHost()->getName())
|
|
|
|
|
->setParam('service.name', $this->object->getName());
|
2017-09-19 11:18:40 -04:00
|
|
|
}
|
2017-09-21 11:03:05 -04:00
|
|
|
|
2017-11-14 08:34:19 -05:00
|
|
|
protected function getMonitoredObjectIdentifier()
|
|
|
|
|
{
|
2022-02-15 03:58:38 -05:00
|
|
|
return $this->object->getHost()->getName() . ':' . $this->object->getName();
|
2017-11-14 08:34:19 -05:00
|
|
|
}
|
|
|
|
|
|
2022-02-15 03:58:38 -05:00
|
|
|
protected function designedForObjectType(Template $template)
|
2018-02-09 07:56:22 -05:00
|
|
|
{
|
|
|
|
|
foreach ($template->getCurves() as $curve) {
|
|
|
|
|
if (in_array('service_name_template', $curve[0]->getMacros())) {
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return false;
|
|
|
|
|
}
|
2017-09-19 11:18:40 -04:00
|
|
|
}
|