Inspired by a friend I’ve decided to install InfluxDB and Grafana on my Raspberry Pi 3. InfluxDB is a database optimized for storing time related data like measurements of my recently installed particle sensor. Grafana is used to create beautiful graphs to display the stored data.
The InfluxDB installation can be done in a few simple steps:
curl -sL https://repos.influxdata.com/influxdb.key | sudo apt-key add - echo "deb https://repos.influxdata.com/debian stretch stable" | sudo tee /etc/apt/sources.list.d/influxdb.list sudo apt update sudo apt install influxdb sudo systemctl enable influxdb sudo systemctl start influxdb influx CREATE DATABASE topics
This will install the InfluxDB without a user and any rights. You can read up further on that topic. Ideally you should setup an user for authentication but since some IoT devices do not support this I’m not going to explain it here.
The Grafana installation is similar simple:
Please make sure that you’ll get the most current version from github and replace it in the wget command:
wget https://github.com/fg2it/grafana-on-raspberry/releases/download/v5.1.4/grafana_5.1.4_armhf.deb sudo dpkg -i grafana_5.1.4_armhf.deb sudo systemctl enable grafana-server sudo systemctl start grafana-server
First login to Grafana:
Now you’re ready to configure Grafana. Go to http://:3000 and setup a new username and password for the webinterface. The default is admin/admin
Configure InfluxDB as datasource in Grafana:
You need to configure a datasource under http://:3000/datasources
Enter as name the name of the database you’ve created earlier. In this case it was topic.
The type of the database is InfluxDB.
The HTTP connection URL is http://localhost:8086
Hit Save & Test, once you’ve configured everything to your liking. The connection to the database should work now.