Install grafana with docker

Setup Grafana with docker

Reading time: 2 min

With a combination of InfluxDB and Grafana an appealing visualization of all conceivable values is possible. This can be the download speed of your internet connection on an hourly basis or the temperature in all rooms with a time resolution of 15 minutes. Grafana offers many configuration options via its own web interface, e.g. connection of different data sources and own views as well as queries for more complex graphs.

Installation of Grafana

With the help of Grafana you have the perfect basis to create visualizations for your individual smarthome in a simple yet appealing way.

Loading the openHAB image of Docker Hub
To install Grafana you first need to download the image from the official Docker Hub site. In the container station you can download the image with one click or use the following command:
docker pull grafana/grafana

Creation of the Grafana container
Afterwards you can start the container using the container station or the correct docker commands. You should also make a note of the IP address and password, as you will need them in the following step. In order to use Grafana with openHAB, you also need to consider the following parameters and restrictions:

Docker configuration for grafana

Installation of Grafana

You can now access Grafana directly via the saved IP address. Grafana can be reached via port 3000. So enter the following into your browser:
Afterwards you log in with the standard user of Grafana “admin” and the password you have assigned during the installation. You will also have to change your password for security reasons.

Link with InfluxB

To access your stored values in the InfluxDB with Grafana, you have to set up this connection once in Grafana.
You can do this directly on the start page via “Add data source”. Select the type of InfluxDB. Afterwards, only the data you wrote down has to be entered. This is the IP address and the port of the InfluxDB installation. Then select “Basic Auth” and enter your noted user data. If you followed my instructions for the InfluxDB, the username and password is “grafana”. Then fill in the database with “openhab_db” (if you named it the same way) and enter your previous user data. When you save and test the connection afterwards, you should see green messages indicating success.

Example of a configuration

Once the connection to InfluxDB is established, you can start creating a dashboard and enrich it with individual panels.
An example configuration of such a panel is shown here:

Panel configuration with grafana

Visualization of a configuration

As soon as everything is set up and configured, you can see appealing visualizations after measuring a few data points. A history of my download speed is shown here:

Panel visualization with grafana

And yes – since I don’t live in certain cities in Germany, my download speed is sometimes not the best ;).

Visualization in openHAB

Integration into openHAB is easily possible via the Grafana URL in a Habpanel. I will create the instructions for this in the coming weeks, so that your visualizations are immediately visible in openHAB.

Further outlook

With the last two articles you could now save states in a database and create visualizations. In my opinion, both are necessary to create more complex routings as well as attractive and simple graphs with the Smarthome.
In the upcoming articles I will take a closer look at the Habpanel in openHAB.

I hope you continue to enjoy reading!

Persönliches Foto

Matthias Suttner

As a smarthome enthusiast, I am happy to present you some interesting possibilities on my blog.