Table of Contents

In the previous part we saw how to install and start using InfluxDB on AWS and learned how it scales. Today we’re going to plot pretty graphs using Grafana.

Grafana introtuction

Grafana is an open source, feature rich graph editor. It can use different database types as a data source. Among those types, interestingly for us, is the InfluxDB. It’s very easy to install and start using, you can refer to the official documentation for more details. Or you can simply use docker:

$ docker run -d -p 3000:3000 grafana/grafana

Grafana to InfluxDB connector

Using data from InfluxDB to plot in Grafana is as simple as filling in a few fields on Grafana -> Data Sources -> Add data source. Choose “InfluxDB” as a Type. The screenshot below should be self-explanatory. Screen-Shot-Grafana-Influx-Connector

Hopefully you configured authentication for your InfluxDB installation (as suggested before) if you’re planning to put it to production use. In this case, fill in the credentials into InfluxDB Details section.

Let’s plot!

We’re now ready to draw graphs. You can create a dashboard (Dashboards -> New) and a first graph (Graph). A click on a “Panel Title” and Edit should show something similar to this: Screen-Shot-Edit-Graph

I’ll now plot graphs using data from Airly air quality sensors. First, average PM25 pollutant levels for sensor 728: Screen-Shot-2017-11-26-at-13.04.46

Resulting graph: Screen-Shot-2017-11-26-at-13.09.27

A few cosmetic changes: Screen-Shot-2017-11-26-at-13.12.55

Let’s now plot a standard deviation for those measurements: Screen-Shot-2017-11-26-at-13.30.07

Let’s now draw a heatmap (Add Panel -> Heatmap). Screen-Shot-2017-11-26-at-13.38.40 This will draw a heatmap of PM25 values for all sensors. The values are grouped into buckets grouped by value (PM25 pollutant in this case), and the color is the number of occurrences of those values in a given timeslot. The higher and more red the boxes are, the worse air Poland breathed at that time. Screen-Shot-2017-11-26-at-13.46.25

Let’s change the colors to classic Red-Yellow-Green



We quickly installed Grafana, connected it to InfluxDB data and started plotting beautiful graphs. Do check out Grafana, if you haven’t yet. It’s a powerful tool that is fairly simple to understand and start using.