mirror of
https://github.com/Icinga/icingaweb2-module-graphite.git
synced 2026-04-15 21:49:43 -04:00
38 lines
705 B
PHP
38 lines
705 B
PHP
|
|
<?php
|
||
|
|
|
||
|
|
namespace Icinga\Module\Graphite;
|
||
|
|
|
||
|
|
use Icinga\Module\Graphite\GraphTemplate;
|
||
|
|
use Icinga\Module\Graphite\GraphiteQuery;
|
||
|
|
|
||
|
|
class GraphiteWeb
|
||
|
|
{
|
||
|
|
protected $baseUrl;
|
||
|
|
|
||
|
|
public function __construct($baseUrl)
|
||
|
|
{
|
||
|
|
$this->baseUrl = $baseUrl;
|
||
|
|
}
|
||
|
|
|
||
|
|
public function select()
|
||
|
|
{
|
||
|
|
return new GraphiteQuery($this);
|
||
|
|
}
|
||
|
|
|
||
|
|
public function getBaseUrl()
|
||
|
|
{
|
||
|
|
return $this->baseUrl;
|
||
|
|
}
|
||
|
|
|
||
|
|
public function listMetrics($filter)
|
||
|
|
{
|
||
|
|
$res = json_decode(
|
||
|
|
file_get_contents(
|
||
|
|
$this->baseUrl . '/metrics/expand?query=' . $filter
|
||
|
|
)
|
||
|
|
);
|
||
|
|
natsort($res->results);
|
||
|
|
return array_values($res->results);
|
||
|
|
}
|
||
|
|
}
|