Why use InfluxDB with Grafana
Grafana is a popular open source dashboarding tool that allows you to query, visualize, and alert on your metrics. It includes a feature-rich data source plugin for InfluxDB as a part of the core offering. The combination of InfluxDB and Grafana allows users to create monitoring solutions that cover a wide range of use cases spanning Infrastructure Monitoring, Application Performance Monitoring, or even monitoring any home or industrial sensor.
Pulling your metric data from your InfluxDB instance in the form of a Grafana dashboard allows your teams to share data that empowers them to look for insights to drive performance improvements. The built-in InfluxDB support in Grafana includes a rich query editor that supports both InfluxDB’s query languages InfluxQL and Flux. With InfluxQL support, you can continue to use all your existing dashboards. And with the added support of Flux, you can define complex queries through a set of functional transformations on data and do complex analytics with the language itself. You can also recompose parts of query functions with user-defined functions (udfs) to create shortcuts for common functionality.
In addition, the Grafana query editor handles measurement, tag, and field value completion, automatic handling of grouping this data by time, and the ability to easily template InfluxDB queries for use across multiple dashboards. You can also alias patterns for short readable series names and ad hoc filters for dashboard exploration that help developers achieve faster time to awesome.
How to use Grafana with InfluxDB
Getting started with both Grafana and InfluxDB is quick and easy, and pulling them together is just as simple. Once you have your InfluxDB instance setup and collecting metrics, you can open your Grafana dashboard and from the main page click on “Add your first data source.”
Main page on Grafana Dashboard
You will then be presented with a page with a selection of core data sources to choose from.
InfluxDB data source option in Grafana
Once you have selected InfluxDB, you can add all the details about your InfluxDB instance including credentials, database, and URL.
InfluxDB setup in Grafana
Once your InfluxDB instance is connected to Grafana, you can start building your first Grafana InfluxDB dashboard. There are a number of pre-canned dashboards that are available from the community that can help you get your projects up and running quickly.
The possibilities of Grafana with Flux
With Grafana’s native support of Flux, users can bring powerful transformations and analytics to their existing monitoring solutions. Some key capabilities that are not possible with InfluxQL but easily accomplished with Flux include:
join() function allows you to join data from any bucket, any measurement, and on any columns. With non-temporal data, this can provide key context to the time series data. And when joining time series data together, you can get even better insights from the data.
Cross-compile: Work on top of Flux with other syntax like PromQL, InfluxQL, and others. Flux works on a single optimizer that plans against different sources.
Window by calendar dates (months, years): Build dashboards that support month and year as duration unit to make forecasting and consumption easier for your users.
Pivoting: Use the
pivot() function to organize data in another way to easily extract information by summarizing, sorting, or even grouping data.
There are many other use cases described in the documentation.