added influxql content to grafana doc

pull/1178/head
Scott Anderson 2020-07-10 14:54:07 -06:00
parent 064770d01d
commit a21c054f25
2 changed files with 64 additions and 11 deletions

View File

@ -10,9 +10,12 @@ weight: 201
v2.0/tags: [grafana]
related:
- https://grafana.com/docs/, Grafana documentation
- /v2.0/query-data/get-started/
- /v2.0/query-data/influxql/
---
Use [Grafana](https://grafana.com/) to visualize data from **InfluxDB 2.0** and **{{< cloud-name "short" >}}**.
Use [Grafana](https://grafana.com/) or [Grafana Cloud](https://grafana.com/products/cloud/)
to visualize data from **InfluxDB 2.0** and **{{< cloud-name "short" >}}**.
{{% note %}}
The instructions in this guide require **Grafana Cloud** or **Grafana v7.1+**.
@ -25,19 +28,27 @@ The instructions in this guide require **Grafana Cloud** or **Grafana v7.1+**.
3. Visit your **Grafana Cloud user interface** (UI) or, if running Grafana locally,
[start Grafana](https://grafana.com/docs/grafana/latest/installation/) and visit
`http://localhost:3000` in your browser.
5. In the left navigation of the Grafana UI, hover over the gear
4. In the left navigation of the Grafana UI, hover over the gear
icon to expand the **Configuration** section. Click **Data Sources**.
6. Click **Add data source**.
7. Select **InfluxDB** from the list of available data sources.
5. Click **Add data source**.
6. Select **InfluxDB** from the list of available data sources.
7. Enter a **name** for your InfluxDB data source.
8. Under **Query Language**, select one of the following:
## Configure your InfluxDB 2.0 connection
In the Grafana UI, configure your InfluxDB data source:
{{< tabs-wrapper >}}
{{% tabs %}}
[Flux](#)
[InfluxQL](#)
{{% /tabs %}}
<!---------------------------- BEGIN FLUX CONTENT ---------------------------->
{{% tab-content %}}
## Configure Grafana to use Flux
With **Flux** selected as the query language in your InfluxDB data source,
configure your InfluxDB connection:
1. Enter a **name** for your InfluxDB data source.
2. Under **Query Language**, select **Flux**.
3. Under **Connection**, enter the following:
1. Under **Connection**, enter the following:
- **URL**: Your [InfluxDB URL](/v2.0/reference/urls/) with the `/api/v2` path.
- **URL**: Your [InfluxDB URL](/v2.0/reference/urls/) **with the `/api/v2` path**.
```sh
http://localhost:9999/api/v2
@ -50,8 +61,50 @@ In the Grafana UI, configure your InfluxDB data source:
{{< img-hd src="/img/2-0-visualize-grafana.png" />}}
4. Click **Save & Test**. Grafana attempts to connect to the InfluxDB 2.0 datasource
2. Click **Save & Test**. Grafana attempts to connect to the InfluxDB 2.0 datasource
and returns the results of the test.
{{% /tab-content %}}
<!----------------------------- END FLUX CONTENT ----------------------------->
<!-------------------------- BEGIN INFLUXQL CONTENT -------------------------->
{{% tab-content %}}
## Configure Grafana to use InfluxQL
{{% cloud %}}
**{{< cloud-name "short" >}}** supports InfluxQL, but **InfluxDB 2.0 OSS** does not.
{{% /cloud %}}
With **InfluxQL** selected as the query language in your InfluxDB data source,
configure your InfluxDB connection:
1. Under **HTTP**, enter the following:
- **URL**: Your [InfluxDB URL](/v2.0/reference/urls/).
```sh
http://localhost:9999
```
- **Access**: Server (default)
2. Under **Auth**, enable **Basic Auth**.
3. Under **Basic Auth Details**, provide your InfluxDB authentication credentials:
- **username**: InfluxDB username
- **password**: InfluxDB [authentication token](/v2.0/security/tokens/)
4. Under **InfluxDB details**, set the following:
- **Database**: The database to use when querying InfluxDB 2.0.
_See [Database and retention policy mapping](/v2.0/reference/api/influxdb-1x/dbrp/)._
- **HTTP Method**: Select **GET**.
- **Min time interval**: The [Grafana minimum time interval](https://grafana.com/docs/grafana/latest/features/datasources/influxdb/#min-time-interval).
{{< img-hd src="/img/2-0-visualize-grafana-influxql.png" />}}
5. Click **Save & Test**. Grafana attempts to connect to the InfluxDB 2.0 datasource
and returns the results of the test.
{{% /tab-content %}}
<!--------------------------- END INFLUXQL CONTENT --------------------------->
{{< /tabs-wrapper >}}
## Query and visualize data
With your InfluxDB connection configured, use Grafana and Flux to query and

Binary file not shown.

After

Width:  |  Height:  |  Size: 66 KiB