zabbix-grafana-on-raspberry

Instructions

Install Dependencies

sudo apt-get update
sudo apt-get install curl git ca-certificates
sudo apt-get install binutils gcc make libc-dev
sudo apt-get install ruby ruby-dev  # for fpm
sudo apt-get install rpm            # for rpmbuild, used indirectly by grafana (call to fpm)
sudo apt-get install libfontconfig1 libicu52 libjpeg62-turbo  # for my phantomjs binary !

Install go 1.5.2 from hypriot :

curl -L https://github.com/hypriot/golang-armbuilds/releases/download/v1.5.2/go1.5.2.linux-armv7.tar.gz | tar -xz -C /usr/local
export PATH=/usr/local/go/bin:$PATH

Install nodejs :

cd /tmp
curl -L https://nodejs.org/dist/latest-v5.x/node-v5.12.0-linux-armv7l.tar.xz | tar xfJ  -                                                       && \
mv -t /usr/local/bin     node-v5.12.0-linux-armv7l/bin/*
mv -t /usr/local/include node-v5.12.0-linux-armv7l/include/*
mv -t /usr/local/lib     node-v5.12.0-linux-armv7l/lib/*
mv -t /usr/local/share   node-v5.12.0-linux-armv7l/share/*

Install fpm :

gem install fpm

Finally, install your phantomjs binary. For example :

wget http://security.debian.org/debian-security/pool/updates/main/i/icu/libicu48_4.8.1.1-12+deb7u5_armhf.deb
 dpkg -i libicu48_4.8.1.1-12+deb7u5_armhf.deb

git clone https://github.com/shabadoo75/phantomjs-2.1.1-raspberrypi-armv7
cp phantomjs-2.1.1-raspberrypi-armv7/phantomjs /usr/bin/

Build Grafana

The good news is you mainly have to follow the official instructions with just a few modifications.

export GOPATH=/tmp/graf-build
mkdir -p $GOPATH
cd $GOPATH
go get github.com/grafana/grafana
cd $GOPATH/src/github.com/grafana/grafana
git checkout v3.1.1
go run build.go setup    
$GOPATH/bin/godep restore   
npm install
npm install -g grunt-cli
npm install node-sass
cd $GOPATH/src/github.com/grafana/grafana

Now, the fix for phantomjs.

export LOC=./node_modules/karma-phantomjs-launcher/node_modules/phantomjs/lib/location.js
echo "module.exports.location = \"`which phantomjs`\"" > $LOC
echo "module.exports.platform = \"linux\"" >> $LOC
echo "module.exports.arch = \"arm\"" >> $LOC

Finally,

go run build.go build package

The packages are in ./dist