Install InfluxDB and Grafana on Raspberry Pi

Many Internet of things projects based on the Raspberry Pi need to save time series data on a database and need an interface to view stored data.

InfluxDB and Grafana are the the perfect tools to do the job.

What is a Raspberry Pi?

The Raspberry Pi is a low cost, credit-card sized computer capable of doing everything you’d expect a desktop computer to; what’s more, the Raspberry Pi has the ability to interact with the outside world using the 0.1” spaced 40-pin GPIO header.

Given the size and the GPIO access (27 GPIO, UART, I2C, SPI as well as 3.3 and 5V sources), the Raspberry Pi has been used as embedded computer in a wide array of digital maker and internet of things, projects. [ 1 ].

The Raspberry Pi model used in this guide is Raspberry Pi 2 Model B with Raspbian.

Raspberry Pi 2 Model B Image courtesy of Adafruit, (CC BY-SA 3.0).

What is InfluxDB?

InfluxDB is a time series, metrics, and analytics database. It’s written in Go and has no external dependencies.

InfluxDB is targeted at use cases for DevOps, metrics, sensor data, and real-time analytics. [ 2 ]

Key Features: [ 2 ]

Example of InfluxDD Admin page

InfluxDB requires Go 1.5 or greater.

What is Grafana?

Grafana is a leading open source application for visualizing large-scale measurement data.

It provides a powerful and elegant way to create, share, and explore data and dashboards from your disparate metric databases, either with your team or the world.

Grafana is most commonly used for Internet infrastructure and application analytics, but many use it in other domains including industrial sensors, home automation, weather, and process control. [ 3 ]

Example of a Grafana dashboard

Grafana requires Go 1.4 and NodeJS.

Install requirements

Install Go

InfluxDB requires Go 1.5 but to install Go 1.5 you need Go 1.4 (see this issue).

GVM provides an interface to manage Go versions.

# requirements
sudo apt-get install curl git mercurial make binutils bison gcc build-essential
# install gvm
bash < <(curl -s -S -L
source /home/pi/.gvm/scripts/gvm
# install go
gvm install go1.4 
gvm use go1.4 
gvm install go1.5
gvm use go1.5 --default

Install NodeJS

Grafana requires NodeJS to build the front-end assets using Grunt.

Adafruit has a good guide about NodeJS on Raspberry Pi.

# add the package repository to your Pi
curl -sLS | sudo bash
# install node.js using apt-get
sudo apt-get install node

Install InfluxDB

Based on “Contributing to InfluxDB”.

# getting the source
go get
# install
cd $GOPATH/src/
go get -u -f -t ./...
go build ./...
# start influxdb

Install Grafana

Based on “Building Grafana from source”.

# getting the source
go get
# building the backend
cd $GOPATH/src/
go run build.go setup
$GOPATH/bin/godep restore
go run build.go build
# build the front-end assets
npm install
sudo npm install -g grunt-cli
# start grafana

Start Your Engines!

# start influxdb
# start grafana
cd $GOPATH/src/
  1. What is a Raspberry Pi?
  2. Overview | InfluxDB
  3. About Grafana