![]() ![]() |
Info | ![]() |
![]() |
![]() ![]() |
Reputation | Support forum | Blog | Links |
Last Updated | Ratings | Unique User Downloads | Download Rankings | |||||
2015-06-13 (1 year ago) ![]() | Not yet rated by the users | Total: 65 | All time: 8,565 This week: 871![]() |
Version | License | PHP version | Categories | |||
kairosdb-client 0.5 | Artistic License | 5.5 | PHP 5, Databases, Web services |
Description | Author | ||||||||||||||
This package can connect and execute queries on KairosDB. Innovation Award |
|
A client library for KairosDB written in PHP. This package provides convenience functions to read and write time series data. It uses the HTTP protocol to communicate with your KairosDB cluster.
$ composer require 'danibrutal/kairosdb-client:dev-master'
Connecting to an KairosDB database is straightforward. You will need a host name a port. The default port is 8080.
For more information please check out the KairosDB Docs.
We can add a single data point:
require 'vendor/autoload.php';
$client = new KairosDB\Client('localhost', 8090);
$tags = ['host'=> 'precise64'];
$metricName = 'network_out';
for($i=2; $i<100; $i++) {
$dataPointValue = $i *2;
$client->addDataPoint($metricName, $dataPointValue, $tags);
usleep(100);
}
Or using batch inserts:
require 'vendor/autoload.php';
$client = new \KairosDB\Client('localhost', 8090);
$tags = ['host'=> 'precise64'];
$metricName = 'network_out';
$dataPointCollection = new \KairosDB\DataPointCollection($metricName, $tags);
for($i=2; $i<100; $i++) {
$dataPointValue = $i *2;
$dataPointCollection->addPoint($dataPointValue);
usleep(100);
}
$client->addDataPoints($dataPointCollection);
The start date is required, but the end date defaults to NOW if not specified. The metric(s) that you are querying for is also required. Optionally, tags may be added to narrow down the search.
require 'vendor/autoload.php';
$client = new KairosDB\Client('localhost', 8090);
$queryBuilder = new \KairosDB\QueryBuilder();
$tags = ['host'=> 'precise64'];
$query = $queryBuilder
->start(['value'=> '1', 'unit' => 'days'])
->cache(10)
->addMetric('network_in')
->tags($tags)
->build();
$results = $client->query($query);
You can get a list of all metric names in KairosDB.
require 'vendor/autoload.php';
$client = new KairosDB\Client('localhost', 8090);
$results = $client->getMetricNames($query);
Similarly you can get a list of all tag names in KairosDB.
require 'vendor/autoload.php';
$client = new KairosDB\Client('localhost', 8090);
$results = $client->getTagNames($query);
And a list of all tag values.
require 'vendor/autoload.php';
$client = new KairosDB\Client('localhost', 8090);
$results = $client->getTagValues($query);
TODO: implement
Please refer to http://kairosdb.github.io/kairosdocs/ for documentation.
![]() |
File | Role | Description | ||
---|---|---|---|---|
![]() |
||||
![]() |
||||
![]() ![]() |
Data | Auxiliary data | ||
![]() ![]() |
Data | Auxiliary data | ||
![]() ![]() |
Data | Auxiliary data | ||
![]() ![]() |
Data | Auxiliary data | ||
![]() ![]() |
Lic. | Auxiliary data | ||
![]() ![]() |
Data | Auxiliary data | ||
![]() ![]() |
Doc. | Auxiliary data |
Version Control | Unique User Downloads | Download Rankings | |||||||||||||||
100% |
|
|
Applications that use this package |
If you know an application of this package, send a message to the author to add a link here.