Install an InfluxDB Grafana stack on a Raspberrypi

From lechacal
Jump to navigation Jump to search

Guide was edited and tested using Raspbian image:
2020-02-13-raspbian-buster-lite.img

Install Influxdb

Access a terminal on the Raspberrypi and enter the commands below to install InfluxDB.

curl -sL https://repos.influxdata.com/influxdb.key | sudo apt-key add -
sudo apt install apt-transport-https
echo "deb https://repos.influxdata.com/debian buster stable" | sudo tee /etc/apt/sources.list.d/influxdb.list
sudo apt-get update
sudo apt-get install influxdb

Setup Influxdb Config

Edit the config file.

sudo nano /etc/influxdb/influxdb.conf

Change the options as shown below.

[http]
  # Determines whether HTTP endpoint is enabled.
  enabled = true

  # The bind address used by the HTTP service.
  bind-address = ":8086"

  # Determines whether user authentication is enabled over HTTP/HTTPS.
  auth-enabled = false

Restart InfluxDB service.

sudo service influxdb restart

Create a database called db01.

curl -i -XPOST http://localhost:8086/query --data-urlencode "q=CREATE DATABASE db01"

Use anything else than db01 if you prefer something else.

Install Grafana

curl https://bintray.com/user/downloadSubjectPublicKey?username=bintray | sudo apt-key add -
echo "deb https://dl.bintray.com/fg2it/deb stretch main" | sudo tee -a /etc/apt/sources.list.d/grafana.list
sudo apt-get update
sudo apt-get install grafana
sudo service grafana-server start
# sudo update-rc.d grafana-server defaults
sudo systemctl enable grafana-server

Setup Grafana

Using a computer on the same network of the Raspberrypi. Open a web browser and go to address

http://raspberrypi:3000

Grafana will show up. Login using user admin password admin.

Go to Configuration | Data Sources

Then click Add data sources.

Enter:
Name: raspberrypi
Type: InfluxDB
URL: http://localhost:8086
Database: db01

Keep everything else by default. Name must be the raspberrypi hostname. Database can be anything you like.