Updated docs
This commit is contained in:
@@ -0,0 +1,33 @@
|
||||
----
|
||||
page_title: Graphite query guide
|
||||
page_description: Graphite query guide
|
||||
page_keywords: grafana, graphite, metrics, query, documentation
|
||||
---
|
||||
|
||||
# Graphite
|
||||
|
||||
Grafana has an advanced graphite query editor that lets you quickly navigate the metric space, add functions.
|
||||
Change function paramaters and much more. The editor cannot handle all types of queries yet.
|
||||
To switch to a regular text box click the pen icon to the right.
|
||||
|
||||
## Navigate metric segments
|
||||
|
||||
Click the ``Select metric`` link to start navigating the metric space. One you start you can continue using the mouse
|
||||
or keyboard arrow keys. You can select a wildcard and still continue.
|
||||
|
||||

|
||||
|
||||
## Functions
|
||||
|
||||
Click the plus icon to the right to add a function. You can search for the function or select it from the menu. Once
|
||||
a function is selected it will be added and your focus will be in the text box of the first parameter. To later change
|
||||
a parameter just click on it and it will turn into a text box. To delete a function click the function name followed
|
||||
by the x icon.
|
||||
|
||||

|
||||
|
||||
|
||||
### Optional parameters
|
||||
Some functions like aliasByNode support an optional second argument. To add this parameter specify for example 3,-2 as the first parameter and the function editor will adapt and move the -2 to a second parameter. To remove the second optional parameter just click on it and leave it blank and the editor will remove it.
|
||||
|
||||

|
||||
@@ -0,0 +1,34 @@
|
||||
----
|
||||
page_title: InfluxDB query guide
|
||||
page_description: InfluxDB query guide
|
||||
page_keywords: grafana, influxdb, metrics, query, documentation
|
||||
---
|
||||
|
||||
|
||||
# InfluxDB
|
||||
|
||||
## InfluxDB query editor
|
||||
|
||||

|
||||
|
||||
When you add an InfluxDB query you can specify series name (can be regex), value column and a function. Group by time can be specified or if left blank will be automatically set depending on how long the current time span is. It will translate to a InfluxDB query that looks like this:
|
||||
|
||||
```sql
|
||||
select [[func]]([[column]]) from [[series]] where [[timeFilter]] group by time([[interval]]) order asc
|
||||
```
|
||||
|
||||
To write the complete query yourself click the cog wheel icon to the right and select ``Raw query mode``.
|
||||
|
||||
## InfluxDB Filters & Templated queries
|
||||
|
||||

|
||||
|
||||
|
||||
Use a distinct influxdb query in the filter query input box:
|
||||
|
||||
```sql
|
||||
select distinct(host) from app.status
|
||||
```
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,113 @@
|
||||
---
|
||||
page_title: OpenTSDB Guide
|
||||
page_description: OpenTSDB guide for Grafana
|
||||
page_keywords: grafana, opentsdb, documentation
|
||||
---
|
||||
|
||||
# OpenTSDB Guide
|
||||
|
||||
Here you will find some configuration tips for how to setup Grafana and OpenTSDB.
|
||||
|
||||
## OpenTSDB configuration
|
||||
|
||||
For OpenTSDB to work in Grafana you will either be needing to run the latest OpenTSDB
|
||||
version built from the `next` branch that includes built in support for remote
|
||||
api usage (CORS). This was merged into the next branch with [this issue](https://github.com/OpenTSDB/opentsdb/pull/333).
|
||||
|
||||
If you upgrade you have to set the OpenTSDB setting `tsd.http.request.cors_domains` to your
|
||||
grafana webserver domain name.
|
||||
|
||||
If you do not want to upgrade OpenTSDB you need to setup an nginx proxy that will add the necessary CORS
|
||||
HTTP headers.
|
||||
|
||||
Example nginx config:
|
||||
|
||||
Replace:
|
||||
|
||||
- **OPENTSDB_HOST** (2 instances) - Hostname or IP address of the OpenTSDB server
|
||||
- **OPENTSDB_PORT** (1 instance) - Port number of the OpenTSDB server
|
||||
- **GRAFANA_DOMAIN** (1 instance) - Domain/Hostname of the Grafana server
|
||||
|
||||
```nginx
|
||||
upstream opentsdb {
|
||||
server OPENTSDB_HOST:OPENTSDB_PORT fail_timeout=0;
|
||||
}
|
||||
|
||||
server {
|
||||
listen *:4243;
|
||||
|
||||
location / {
|
||||
# Regex to whitelist systems
|
||||
if ($http_origin ~* (https?://([a-z0-9._-]*\.)?GRAFANA_DOMAIN(:[0-9]+)?)) {
|
||||
set $cors "true";
|
||||
}
|
||||
|
||||
# OPTIONS indicates a CORS pre-flight request
|
||||
if ($request_method = 'OPTIONS') {
|
||||
set $cors "${cors}-options";
|
||||
}
|
||||
|
||||
# If it's OPTIONS, then it's a CORS preflight request so respond immediately with no response body
|
||||
if ($cors = "true-options") {
|
||||
add_header 'Access-Control-Allow-Origin' "$http_origin";
|
||||
add_header 'Access-Control-Allow-Credentials' 'true';
|
||||
add_header 'Access-Control-Max-Age' 1728000;
|
||||
add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS';
|
||||
add_header 'Access-Control-Allow-Headers' 'Authorization,Content-Type,Accept,Origin,User-Agent,DNT,Cache-Control,X-Mx-ReqToken,Keep-Alive,X-Requested-With,If-Modified-Since';
|
||||
add_header 'Content-Length' 0;
|
||||
add_header 'Content-Type' 'text/plain charset=UTF-8';
|
||||
return 204;
|
||||
}
|
||||
|
||||
# Proxy the request
|
||||
proxy_set_header X-Host OPENTSDB_HOST;
|
||||
proxy_set_header X-Forwarded-For $Proxy_add_x_forwarded_for;
|
||||
proxy_set_header Authorization "";
|
||||
proxy_pass http://opentsdb;
|
||||
proxy_redirect default;
|
||||
proxy_buffer_size 16k;
|
||||
proxy_buffers 8 32k;
|
||||
proxy_busy_buffers_size 64k;
|
||||
proxy_temp_file_write_size 64k;
|
||||
proxy_read_timeout 120;
|
||||
# Strip any OpenTSDB-generated CORS headers that overlap with our own
|
||||
proxy_hide_header 'Access-Control-Allow-Origin';
|
||||
proxy_hide_header 'Access-Control-Allow-Credentials';
|
||||
proxy_hide_header 'Access-Control-Allow-Headers';
|
||||
|
||||
# if it's a GET or POST, set the standard CORS responses header
|
||||
if ($cors = "true") {
|
||||
# Add our own CORS headers
|
||||
add_header 'Access-Control-Allow-Origin' "$http_origin";
|
||||
add_header 'Access-Control-Allow-Credentials' 'true';
|
||||
add_header 'Access-Control-Allow-Headers' '*';
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## Grafana config
|
||||
In config.js specify your opentsdb datasource:
|
||||
|
||||
```javascript
|
||||
datasources: {
|
||||
'OpenTSDB-TEST': {
|
||||
default: true,
|
||||
type: 'opentsdb',
|
||||
url: "http://my_opentsdb_server:4242"
|
||||
}
|
||||
},
|
||||
```
|
||||
|
||||
## Create a graph
|
||||
Open a graph in edit mode by click the title.
|
||||
|
||||

|
||||
|
||||
For details on opentsdb metric queries
|
||||
checkout the offical [OpenTSDB documentation](http://opentsdb.net/docs/build/html/index.html)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user