Use Grafana to query and visualize data
Limited availability
InfluxDB Clustered is currently only available to a limited group of InfluxData customers. If interested in being part of the limited access group, please contact the InfluxData Sales team.
Use Grafana to query and visualize data stored in InfluxDB Clustered. InfluxDB Clustered supports both SQL and InfluxQL query languages. Install the Grafana FlightSQL plugin to query InfluxDB with SQL using the Flight SQL protocol. Use the InfluxDB core Grafana plugin to query data with InfluxQL.
[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.
- Install Grafana or login to Grafana Cloud
- Install the FlightSQL plugin
- Create a datasource
- Query InfluxDB with Grafana
- Build visualizations with Grafana
Install Grafana or login to Grafana Cloud
If using the open source version of Grafana, follow the Grafana installation instructions to install Grafana for your operating system. If using Grafana Cloud, login to your Grafana Cloud instance.
Install the FlightSQL plugin
If you want to query InfluxDB Clustered with SQL, install the Grafana FlightSQL plugin.
Only required if using SQL
Installing the Grafana FlightSQL plugin is only required if using SQL to query data from InfluxDB. If using InfluxQL, enable the Grafana InfluxDB core plugin.
When using the local version of Grafana, you can install the FlightSQL plugin
with the grafana-cli
CLI or in
the Grafana user interface (UI).
Use grafana-cli
Run the following command to install the FlightSQL plugin:
grafana-cli plugins install influxdata-flightsql-datasource
After installing the plugin, you may need to restart your Grafana server.
Use the Grafana UI
- In the Grafana UI, navigate to Configuration > Plugins.
- Search for and select the FlightSQL plugin.
- Click Install.
- In your Grafana Cloud instance, navigate to Administration > Plugins.
- Search for and select the FlightSQL plugin.
- Click Install via grafana.com to navigate to the plugin page.
- On the plugin page, click Install plugin.
After a moment, Grafana Cloud completes the plugin installation in your Grafana Cloud instance.
Create a datasource
Which datasource you create depends on which query language you want to use to query InfluxDB Clustered:
- To query with SQL, create a FlightSQL datasource.
- To query with InfluxQL, create an InfluxDB datasource.
In your Grafana user interface (UI), navigate to Data Sources.
Click Add new data source.
Search for and select the FlightSQL plugin.
Provide a name for your datasource.
Add your connection credentials:
Host: Provide the host and port of your Flight SQL client. For InfluxDB Clustered, this is your cluster URL and port 443:
cluster-host.com:443
AuthType: Select token.
Token: Provide your InfluxDB database token with read access to the databases you want to query.
Require TLS/SSL: Enable this toggle.
Add connection MetaData. Provide key-value pairs to send to your Flight SQL client.
InfluxDB Clustered requires your database name:
- Key:
database
- Value: Database name
- Key:
Click Save & test.
If successful, click Explore to begin querying InfluxDB with Flight SQL and Grafana.
In your Grafana user interface (UI), navigate to Data Sources.
Click Add new data source.
Search for and select the InfluxDB core plugin.
Provide a name for your datasource.
Under Query Language, select InfluxQL. InfluxDB Clustered does not support Flux.
Under HTTP:
URL: Provide your InfluxDB cluster URL using the HTTPS protocol:
https://cluster-host.com
Under InfluxDB Details:
- Database: Provide a default database name to query.
- User: Provide an arbitrary string. This credential is ignored when querying InfluxDB Clustered, but it cannot be empty.
- Password: Provide an InfluxDB database token with read access to the databases you want to query.
Click Save & test.
Query InfluxDB with Grafana
After you configure and save a FlightSQL or InfluxDB datasource, use Grafana to build, run, and inspect queries against your InfluxDB database.
When working with the InfluxDB SQL implementation, a bucket is equivalent to a database, a measurement is structured as a table, and time, fields, and tags are structured as columns. To learn more, see Query Data.
- Click Explore.
- In the dropdown, select the FlightSQL 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.
- Click Explore.
- In the dropdown, select the InfluxDB data source that you want to query.
- Use the InfluxQL query form to build your query:
- FROM: Select the measurement that you want to query.
- WHERE: To filter the query results, enter a conditional expression.
- SELECT: Select fields to query and an aggregate function to apply to each.
The aggregate function is applied to each time interval defined in the
GROUP BY
clause. - GROUP BY: By default, Grafana groups data by time to downsample results and improve query performance. You can also add other tags to group by.
- Click Run query to execute the 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.
Was this page helpful?
Thank you for your feedback!
Support and feedback
Thank you for being part of our community! We welcome and encourage your feedback and bug reports for InfluxDB and this documentation. To find support, use the following resources:
Customers with an annual or support contract can contact InfluxData Support.