9.5 KiB
title | seotitle | list_title | description | weight | menu | influxdb/cloud-iox/tags | aliases | alt_engine | |||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Use Grafana to query and visualize data | Use Grafana to query and visualize data stored in InfluxDB Cloud (IOx) | Use Grafana | Install and run [Grafana](https://grafana.com/) to query and visualize data stored in an InfluxDB bucket powered by InfluxDB IOx. | 101 |
|
|
|
/influxdb/cloud/tools/grafana/ |
Use Grafana to query and visualize data stored in an InfluxDB bucket powered by InfluxDB IOx. Install the grafana-flight-sql-plugin to query InfluxDB with the Flight SQL protocol.
[Grafana] enables you to query, visualize, alert on, and explore your metrics, logs, and traces wherever they are stored. [Grafana] provides you with tools to turn your time-series database (TSDB) data into insightful graphs and visualizations.
{{% caption %}}Grafana documentation{{% /caption %}}
- Install Grafana
- Download the Grafana Flight SQL plugin
- Extract the Flight SQL plugin
- Install the Grafana Flight SQL plugin
- Configure the Flight SQL datasource
- Query InfluxDB with Grafana
- Build visualizations with Grafana
Install Grafana
Follow Grafana instructions to Install Grafana for your operating system.
{{% warn %}} Because Grafana Flight SQL Plugin is a custom plugin, you can't use it with Grafana Cloud. For more information, see Find and Use Plugins in the Grafana Cloud documentation {{% /warn %}}
Create a custom plugins director
Create a custom plugins directory to store the Flight SQL plugin in and navigate into the directory. The custom plugins directory can be anywhere in your filesystem that Grafana can access.
{{% code-callout "/custom/plugins/directory" %}}
mkdir -p /custom/plugins/directory/ && cd $_
{{% /code-callout %}}
Download the Grafana Flight SQL plugin
Use the following shell script to download and extract the latest Grafana Flight SQL plugin into the the current working directory. Run the following inside your custom plugin directory:
curl -s https://docs.influxdata.com/downloads/download-grafana-flightsql-plugin.sh | bash
{{< expand-wrapper >}} {{% expand "View the script source code" %}}
{{% readfile "/static/downloads/download-grafana-flightsql-plugin.sh" %}}
{{% /expand %}} {{< /expand-wrapper >}}
{{% warn %}} The Grafana Flight SQL plugin is experimental and subject to change. {{% /warn %}}
Install the Grafana Flight SQL plugin
Install the custom-built Flight SQL plugin in a local or Docker-based instance of Grafana OSS or Grafana Enterprise.
{{< tabs-wrapper >}} {{% tabs %}} Local Docker {{% /tabs %}}
{{% tab-content %}}
Follow these steps to edit the Grafana configuration file or set environment variables to install the plugin.
{{% note %}}
If you used Homebrew to install Grafana, follow the steps to edit the
/homebrew/install/path/etc/grafana/grafana.ini
configuration file.
Replace /homebrew/install/path
with the output of the brew --prefix
command for your system.
For information about where to find your Grafana configuration file or what environment variables are available, see the Configure Grafana documentation.
{{% /note %}}
-
Set your Grafana custom plugin directory. Do one of the following:
-
In your Grafana configuration file, set the
paths.plugins
directive to the path of your custom plugins directory:[paths] plugins = /custom/plugins/directory/
-
Set the
GF_PATHS_PLUGINS
environment variable to the path of your custom plugins directory:GF_PATHS_PLUGINS=/custom/plugins/directory/
-
-
Restart Grafana to apply the configuration changes.
{{% /tab-content %}} {{% tab-content %}}
To add the Flight SQL plugin to your pre-existing Grafana Docker deployment,
use docker run
or docker-compose
to do the following:
- Mount the plugin directory (
/custom/plugins/directory/influxdata-flightsql-datasource
) as a volume to your Grafana container.
Install with Docker Run
{{% code-callout "/custom/plugins/directory" %}}
docker run \
--volume $PWD/influxdata-flightsql-datasource:/custom/plugins/directory/influxdata-flightsql-datasource \
--publish 3000:3000 \
--name grafana \
grafana/grafana:latest
{{% /code-callout %}}
Install with Docker-Compose
{{% code-callout "/custom/plugins/directory" %}}
version: '3'
services:
grafana:
image: grafana/grafana:latest
ports:
- 3000:3000
volumes:
- ./influxdata-flightsql-datasource:/custom/plugins/directory/influxdata-flightsql-datasource
restart: always
{{% /code-callout %}}
- Replace
/custom/plugins/directory
with the path of your custom plugins directory.
{{% /tab-content %}} {{< /tabs-wrapper >}}
Configure the Flight SQL datasource
-
In your Grafana user interface (UI), navigate to Data Sources.
-
Click Add data source.
-
Search for and select the Flight SQL plugin. 4 Provide a name for your datasource.
-
Add your connection credentials:
-
Host: Provide the host and port of your Flight SQL client. For InfluxDB {{< current-version >}}, this is your {{% cloud-only %}}InfluxDB Cloud region domain{{% /cloud-only %}} {{% oss-only %}}InfluxDB domain{{% /oss-only %}} and port 443. For example:
us-east-1-1.aws.cloud2.influxdata.com:443
-
AuthType: Select token.
-
Token: Provide your InfluxDB API token with read access to the buckets you want to query.
-
Require TLS/SSL: {{% cloud-only %}}Enable this toggle.{{% /cloud-only %}} {{% oss-only %}}If TLS is configured and enabled on your InfluxDB instance, enable this toggle.{{% /oss-only %}}
-
-
Add connection MetaData. Provide optional key-value pairs to send to your Flight SQL client.
InfluxDB {{< current-version >}} requires your bucket name or bucket-id:
- Key:
bucket-name
orbucket-id
- Value: Bucket name or bucket ID
- Key:
-
Click Save & test.
{{< img-hd src="/img/influxdb/cloud-iox-grafana-flightsql-datasource.png" alt="Grafana Flight SQL datasource" />}}
If successful, click Explore to begin querying InfluxDB with Flight SQL and Grafana.
Query InfluxDB with Grafana
After you configure and save a Flight SQL datasource, use Grafana to build, run, and inspect queries against InfluxDB buckets.
{{% note %}} {{% sql/sql-schema-intro %}} To learn more, see Query Data. {{% /note %}}
- Click Explore.
- In the dropdown, select the saved data source that you want to query.
- Use the SQL query form to build your query:
- FROM: Select the measurement that you want to query.
- SELECT: Select one or more fields and tags to return as columns in query results.
In Grafana, you must specify a time column in the
SELECT
list. - WHERE: To filter the query results, enter a conditional expression.
- GROUP BY: To
GROUP BY
one or more fields or tags, enter them as a comma-delimited list. If you include an aggregate function in the SELECT list, then you must include one or more of the queried columns in aGROUP BY
orPARTITION BY
clause. SQL will return the aggregation for each group or partition.
- Click Run query to execute the query. {{< img-hd src="/img/influxdb/cloud-iox-grafana-flightsql-explore-query-1.png" alt="Grafana Flight SQL datasource query" />}}
To learn about query management and inspection in Grafana, see the Grafana Explore documentation.
Build visualizations with Grafana
For a comprehensive walk-through of creating visualizations with Grafana, see the Grafana documentation.