Getting started with Grafana and InfluxDB
Use the instructions in to:
- Log in to Grafana.
- Create your first dashboard.
You can also configure a Grafana Cloud instance to display system metrics without having to host Grafana yourself.
Step 2. Get InfluxDB
You can download InfluxDB and install it locally or you can sign up for .
. This tool is an agent that helps you get metrics into InfluxDB. For more information, refer to Telegraf documentation.
If you chose to use InfluxDB Cloud, then you should . This tool allows you to send command line instructions to your cloud account. For more information, refer to Influx CLI documentation.
Step 4. Get data into InfluxDB
If you downloaded and installed InfluxDB on your local machine, then use the Quick Start feature to visualize InfluxDB metrics.
If you are using the cloud account, then the wizards will guide you through the initial process. For more information, refer to .
Note: The regular system monitoring template in InfluxDB Cloud is not compatible with Windows. Windows users who use InfluxDB Cloud to monitor their system will need to use the Windows System Monitoring Template.
You can have more than one InfluxDB data source defined in Grafana.
- Follow the general instructions to add a data source.
- Decide if you will use InfluxQL or Flux as your query language.
- For InfluxQL, refer to for information about specific data source fields.
- For Flux, refer to Flux query language in Grafana for information about specific data source fields.
InfluxDB publishes guidance for connecting different versions of their product to Grafana.
- InfluxDB OSS or Enterprise 1.8+. To turn on Flux, refer to Configure InfluxDB. Select your InfluxDB version in the upper right corner.
- InfluxDB OSS or Enterprise 2.x. Refer to . Select your InfluxDB version in the upper right corner.
- InfluxDB Cloud. Refer to Use Grafana with InfluxDB Cloud.
- Make sure your Grafana token has read access. If it doesn’t, then you’ll get an authentication error and be unable to connect Grafana to InfluxDB.
- Avoid apostrophes and other non-standard characters in bucket and token names.
- If the text name of the organization or bucket doesn’t work, then try the ID number.
Step 6. Add a query
This step varies depending on the query language that you selected when you set up your data source in Grafana.
In the query editor, click select measurement.
Grafana displays a list of possible series. Click one to select it, and Grafana graphs any available data. If there is no data to display, then try another selection or check your data source.
Create a simple Flux query.
- .
- In the query editor, select your InfluxDB-Flux data source. For more information, refer to Queries.
- Select the Table visualization.
- In the query editor text field, enter and then click outside of the query editor.
This generic query returns a list of buckets.
In your browser, log in to the InfluxDB native UI (OSS is typically something like or for InfluxDB Cloud use: https://cloud2.influxdata.com).
Click Explore to open the Data Explorer.
The InfluxDB Data Explorer provides two mechanisms for creating Flux queries: a graphical query editor and a script editor. Using the graphical query editor, . It will look something like this:
Click Script Editor to view the text of the query, and then copy all the lines of your Flux code, which will look something like this:
In Grafana, add a panel and then paste your Flux code into the query editor.
Click Apply. Your new panel should be visible with data from your Flux query.
In your Grafana instance, go to the Explore view and build queries to experiment with the metrics you want to monitor. Here you can also debug issues related to collecting metrics.
Step 8. Start building dashboards
There you go! Use Explore and Data Explorer to experiment with your data, and add the queries that you like to your dashboard as panels. Have fun!
- Grafana documentation: InfluxDB data source
- InfluxDB documentation: