2015-03-10 02:55:42 -05:00
---
page_title: OpenTSDB Guide
page_description: OpenTSDB guide for Grafana
page_keywords: grafana, opentsdb, documentation
---
# OpenTSDB Guide
2015-08-10 16:44:08 -05:00
The newest release of Grafana adds additional functionality when using an OpenTSDB Data source.
2015-03-10 02:55:42 -05:00
2015-08-11 09:12:58 -05:00
![](/img/v2/add_OpenTSDB.jpg)
2015-03-10 02:55:42 -05:00
2015-08-10 16:44:08 -05:00
1. Open the side menu by clicking the the Grafana icon in the top header.
2. In the side menu under the `Dashboards` link you should find a link named `Data Sources` .
2015-03-10 02:55:42 -05:00
2015-08-10 16:44:08 -05:00
> NOTE: 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.
3. Click the `Add new` link in the top header.
4. Select `OpenTSDB` from the dropdown.
2015-03-10 02:55:42 -05:00
2015-04-13 04:49:12 -05:00
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 you opentsdb server (default port is usually 4242)
Access | Proxy = access via Grafana backend, Direct = access directory from browser.
2016-02-11 01:01:37 -06:00
Version | Version = opentsdb version, either < =2.1 or 2.2
2015-03-10 02:55:42 -05:00
2015-04-13 04:49:12 -05:00
## Query editor
2015-03-10 02:55:42 -05:00
Open a graph in edit mode by click the title.
2015-04-13 04:49:12 -05:00
![](/img/v2/opentsdb_query_editor.png)
2015-03-10 02:55:42 -05:00
2015-07-03 08:13:06 -05:00
### Auto complete suggestions
2015-10-31 00:11:17 -05:00
As soon as you start typing metric names, tag names and tag values , you should see highlighted auto complete suggestions for them.
2015-08-10 16:44:08 -05:00
2015-10-31 00:11:17 -05:00
> Note: This is required for the OpenTSDB `suggest` api to work.
2015-07-03 08:13:06 -05:00
2015-06-30 08:37:59 -05:00
## Templating queries
2015-08-10 16:44:08 -05:00
Grafana's OpenTSDB data source now supports template variable values queries. This means you can create template variables that fetch the values from OpenTSDB (for example metric names, tag names, or tag values). The query editor is also enhanced to limiting tags by metric.
2015-06-30 08:37:59 -05:00
When using OpenTSDB with a template variable of `query` type you can use following syntax for lookup.
2015-10-04 06:54:43 -05:00
metrics(prefix) // returns metric names with specific prefix (can be empty)
2015-06-30 08:37:59 -05:00
tag_names(cpu) // return tag names (i.e. keys) for a specific cpu metric
tag_values(cpu, hostname) // return tag values for metric cpu and tag key hostname
2015-10-04 06:54:43 -05:00
suggest_tagk(prefix) // return tag names (i.e. keys) for all metrics with specific prefix (can be empty)
suggest_tagv(prefix) // return tag values for all metrics with specific prefix (can be empty)
2015-06-30 08:37:59 -05:00
2015-10-31 17:07:24 -05:00
If you do not see template variables being populated in `Preview of values` section, you need to enable `tsd.core.meta.enable_realtime_ts` in the OpenTSDB server settings. Also, to populate metadata of the existing time series data in OpenTSDB, you need to run `tsdb uid metasync` on the OpenTSDB server.
2015-10-31 00:11:17 -05:00
> Note: This is required for the OpenTSDB `lookup` api to work.
2015-10-04 06:54:43 -05:00
For details on opentsdb metric queries checkout the official [OpenTSDB documentation ](http://opentsdb.net/docs/build/html/index.html )