Commit 9266d378 by Torkel Ödegaard

Merge remote-tracking branch 'origin/kariosdb'

Conflicts:
	public/test/test-main.js
parents 24bab47f dc70894d
...@@ -60,6 +60,7 @@ pages: ...@@ -60,6 +60,7 @@ pages:
- ['datasources/graphite.md', 'Data Sources', 'Graphite'] - ['datasources/graphite.md', 'Data Sources', 'Graphite']
- ['datasources/influxdb.md', 'Data Sources', 'InfluxDB'] - ['datasources/influxdb.md', 'Data Sources', 'InfluxDB']
- ['datasources/opentsdb.md', 'Data Sources', 'OpenTSDB'] - ['datasources/opentsdb.md', 'Data Sources', 'OpenTSDB']
- ['datasources/kairosdb.md', 'Data Sources', 'KairosDB']
- ['project/building_from_source.md', 'Project', 'Building from source'] - ['project/building_from_source.md', 'Project', 'Building from source']
- ['project/cla.md', 'Project', 'Contributor License Agreement'] - ['project/cla.md', 'Project', 'Contributor License Agreement']
......
---
page_title: KairosDB Guide
page_description: KairosDB guide for Grafana
page_keywords: grafana, kairosdb, documentation
---
# KairosDB Guide
## Adding the data source to Grafana
Open the side menu by clicking the the Grafana icon in the top header. In the side menu under the `Dashboards` link you
should find a link named `Data Sources`. If this link is missing in the side menu it means that your current
user does not have the `Admin` role for the current organization.
<!-- ![](/img/v2/add_datasource_kairosdb.png) -->
Now click the `Add new` link in the top header.
Name | Description
------------ | -------------
Name | The data source name, important that this is the same as in Grafana v1.x if you plan to import old dashboards.
Default | Default data source means that it will be pre-selected for new panels.
Url | The http protocol, ip and port of your kairosdb server (default port is usually 8080)
Access | Proxy = access via Grafana backend, Direct = access directory from browser.
## Query editor
Open a graph in edit mode by click the title.
<!-- ![](/img/v2/kairosdb_query_editor.png) -->
For details on KairosDB metric queries checkout the offical.
- [Query Metrics - KairosDB 0.9.4 documentation](http://kairosdb.github.io/kairosdocs/restapi/QueryMetrics.html).
## Templated queries
KairosDB Datasource Plugin provides following functions in `Variables values query` field in Templating Editor to query `metric names`, `tag names`, and `tag values` to kairosdb server.
Name | Description
---- | ----
`metrics(query)` | Returns a list of metric names. If nothing is given, returns a list of all metric names.
`tag_names(query)` | Returns a list of tag names. If nothing is given, returns a list of all tag names.
`tag_values(query)` | Returns a list of tag values. If nothing is given, returns a list of all tag values.
For details of `metric names`, `tag names`, and `tag values`, please refer to the KairosDB documentations.
- [List Metric Names - KairosDB 0.9.4 documentation](http://kairosdb.github.io/kairosdocs/restapi/ListMetricNames.html)
- [List Tag Names - KairosDB 0.9.4 documentation](http://kairosdb.github.io/kairosdocs/restapi/ListTagNames.html)
- [List Tag Values - KairosDB 0.9.4 documentation](http://kairosdb.github.io/kairosdocs/restapi/ListTagValues.html)
...@@ -10,7 +10,7 @@ It provides a powerful and elegant way to create, share, and explore data and da ...@@ -10,7 +10,7 @@ It provides a powerful and elegant way to create, share, and explore data and da
Grafana is most commonly used for Internet infrastructure and application analytics, but many use it in other domains including industrial sensors, home automation, weather, and process control. Grafana is most commonly used for Internet infrastructure and application analytics, but many use it in other domains including industrial sensors, home automation, weather, and process control.
Grafana features pluggable panels and data sources allowing easy extensibility. There is currently rich support for [Graphite](http://graphite.readthedocs.org/en/latest/), [InfluxDB](http://influxdb.org) and [OpenTSDB](http://opentsdb.net). There is also experimental support for KairosDB, and SQL is on the roadmap. Grafana has a variety of panels, including a fully featured graph panel with rich visualization options. Grafana features pluggable panels and data sources allowing easy extensibility. There is currently rich support for [Graphite](http://graphite.readthedocs.org/en/latest/), [InfluxDB](http://influxdb.org) and [OpenTSDB](http://opentsdb.net). There is also experimental support for [KairosDB](https://github.com/kairosdb/kairosdb), and SQL is on the roadmap. Grafana has a variety of panels, including a fully featured graph panel with rich visualization options.
Version 2.0 was released in April 2015: Grafana now ships with its own backend server that brings [many changes and features](../guides/whats-new-in-v2/). Version 2.0 was released in April 2015: Grafana now ships with its own backend server that brings [many changes and features](../guides/whats-new-in-v2/).
......
<div ng-include="httpConfigPartialSrc"></div>
{
"pluginType": "datasource",
"name": "KairosDB",
"type": "kairosdb",
"serviceName": "KairosDBDatasource",
"module": "plugins/datasource/kairosdb/datasource",
"partials": {
"config": "app/plugins/datasource/kairosdb/partials/config.html",
"query": "app/plugins/datasource/kairosdb/partials/query.editor.html"
},
"metrics": true,
"annotations": false
}
define([
'helpers',
'plugins/datasource/kairosdb/datasource'
], function(helpers) {
'use strict';
describe('KairosDBDatasource', function() {
var ctx = new helpers.ServiceTestContext();
beforeEach(module('grafana.services'));
beforeEach(ctx.providePhase(['templateSrv']));
beforeEach(ctx.createService('KairosDBDatasource'));
beforeEach(function() {
ctx.ds = new ctx.service({ url: ''});
});
describe('When querying kairosdb with one target using query editor target spec', function() {
var results;
var urlExpected = "/api/v1/datapoints/query";
var bodyExpected = {
metrics: [{ name: "test" }],
cache_time: 0,
start_relative: {
value: "1",
unit: "hours"
}
};
var query = {
range: { from: 'now-1h', to: 'now' },
targets: [{ metric: 'test', downsampling: '(NONE)'}]
};
var response = {
queries: [{
sample_size: 60,
results: [{
name: "test",
values: [[1420070400000, 1]]
}]
}]
};
beforeEach(function() {
ctx.$httpBackend.expect('POST', urlExpected, bodyExpected).respond(response);
ctx.ds.query(query).then(function(data) { results = data; });
ctx.$httpBackend.flush();
});
it('should generate the correct query', function() {
ctx.$httpBackend.verifyNoOutstandingExpectation();
});
it('should return series list', function() {
expect(results.data.length).to.be(1);
expect(results.data[0].target).to.be('test');
});
});
});
});
...@@ -130,6 +130,7 @@ require([ ...@@ -130,6 +130,7 @@ require([
'specs/influx09-querybuilder-specs', 'specs/influx09-querybuilder-specs',
'specs/influxdb-datasource-specs', 'specs/influxdb-datasource-specs',
'specs/influxdbQueryCtrl-specs', 'specs/influxdbQueryCtrl-specs',
'specs/kairosdb-datasource-specs',
'specs/graph-ctrl-specs', 'specs/graph-ctrl-specs',
'specs/graph-specs', 'specs/graph-specs',
'specs/graph-tooltip-specs', 'specs/graph-tooltip-specs',
...@@ -155,4 +156,3 @@ require([ ...@@ -155,4 +156,3 @@ require([
window.__karma__.start(); window.__karma__.start();
}); });
}); });
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment