icingaweb2-module-graphite/library/Graphite/GraphiteWeb.php
2015-06-03 10:30:57 +02:00

37 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);
}
}