4.6 KiB
title | description | menu | weight | v2.0/tags | related | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Use Grafana with InfluxDB | Use [Grafana](https://grafana.com/) to visualize data from **InfluxDB 2.0** and **InfluxDB Cloud**. |
|
201 |
|
|
Use Grafana or Grafana 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+. {{% /note %}}
- Sign up for {{< cloud-name >}} or start InfluxDB 2.0 OSS.
- Sign up for Grafana Cloud or download and install Grafana.
- Visit your Grafana Cloud user interface (UI) or, if running Grafana locally,
start Grafana and visit
http://localhost:3000
in your browser. - In the left navigation of the Grafana UI, hover over the gear icon to expand the Configuration section. Click Data Sources.
- Click Add data source.
- Select InfluxDB from the list of available data sources.
- On the Data Source configuration page, enter a name for your InfluxDB data source.
- Under Query Language, select one of the following:
{{< tabs-wrapper >}} {{% tabs %}} Flux InfluxQL {{% /tabs %}}
{{% tab-content %}}
Configure Grafana to use Flux
With Flux selected as the query language in your InfluxDB data source, configure your InfluxDB connection:
-
Under Connection, enter the following:
-
URL: Your InfluxDB URL with the
/api/v2
path.http://localhost:9999/api/v2
-
Organization: Your InfluxDB organization name or ID.
-
Token: Your InfluxDB authentication token.
-
Default Bucket: The default bucket to use in Flux queries.
-
Min time interval: The Grafana minimum time interval.
{{< img-hd src="/img/2-0-visualize-grafana.png" />}}
-
-
Click Save & Test. Grafana attempts to connect to the InfluxDB 2.0 datasource and returns the results of the test. {{% /tab-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:
-
Under HTTP, enter the following:
-
URL: Your InfluxDB URL.
https://cloud2.influxdata.com
-
Access: Server (default)
-
-
Under Auth, enable Basic Auth.
-
Under Basic Auth Details, provide your InfluxDB authentication credentials:
- username: InfluxDB username
- password: InfluxDB authentication token
-
Under InfluxDB details, set the following:
- Database: The database to use when querying InfluxDB 2.0. See Database and retention policy mapping.
- HTTP Method: Select GET.
- Min time interval: The Grafana minimum time interval.
{{< img-hd src="/img/2-0-visualize-grafana-influxql.png" />}}
-
Click Save & Test. Grafana attempts to connect to the InfluxDB 2.0 datasource and returns the results of the test. {{% /tab-content %}}
{{< /tabs-wrapper >}}
Query and visualize data
With your InfluxDB connection configured, use Grafana and Flux to query and visualize time series data stored in InfluxDB 2.0 or {{< cloud-name >}}.
For more information about using Grafana, see the Grafana documentation. If you're just learning Flux, see Get started with Flux.