Installing Grafana on Raspberry Pi 2 (2015-10-24)

Collecting time series data like stock market or home automation data and storing it in InfluxDB is easy using the new Go client library of InfluxDB.

The next step is displaying the data like temperatures as continuously updated graphs.

Grafana is a nice, widely used web interface displaying data as graphs. It works well with InfluxDB but also with other backends like ElasticSearch.

In a previous post I documented how InfluxDB can be installed on the Raspberry Pi. This post summarizes my experience at installing Grafana on the Pi. Also that tool is working reliable since a while on the Pi. It comes with a web-server so you can display the graphs on any device.

For installing Grafana on the Raspberry Pi 2 it needs to be built from scratch (I couldn't find it in a repository for ARM). It appears to consist of Go and node.js. Hence you need to have the Go compiler, git, and nodes.js installed.

Building the Go backend:

$ go get github.com/grafana/grafana
$ cd $GOPATH/src/github.com/grafana/grafana
$ go run build.go setup 
$ $GOPATH/bin/godep restore && go run build.go build

Building the frontend:

 $ sudo aptitude install npm
 $ sudo aptitude install node
 $ sudo npm config set registry http://registry.npmjs.org/
 $ sudo npm install tap

Finally I found myself in the dependency hell of node.js - the Go part was just so simple. IIRC to get grunt installed I needed to update npm as well as install n.

 $ sudo npm install npm -g
 $ sudo npm install n -g
 $ sudo npm install grunt -g

Finally the frontend can be build (you need to be in the grafana directory):

$ sudo npm install

At the beginning it resulted in version compatibility issues of some libraries. What helped is re-installing the required versions of them with sudo npm install tool@version -g and then running the npm install again.

Finally run:

$ grunt --force

If all that was successful Grafana can be started:

$ ./bin/grafana-server 

Then you can login now on port 3000 create your user and organization, adding your InfluxDB data sources, and finally your graphs based on the data you are constantly adding to InfluxDB.

Really a cool thing and a pretty useful tool for displaying all kinds of measurements you are doing.