Screen Shot 2018-02-27 at 12.36.35

I fell asleep on a train with an empty head. The train made a stop and I woke up, my head filled with an idea and some kind of mad inspiration to follow it through: it was time to move the home metrics stuff out of the old netbook and into the cloud.

The 1.0 setup has served well for over 3 years now, without hardly any interventions. In fact, this all started some 5 years ago(!). TL;DR I’m sending sensor metrics using Node.js to a dashboard based on the time series database Graphite. Kill your darlings and welcome to the age of cloud!

Hosted Graphite packs Graphite with Grafana to visualise metrics stored in the time series database. Hosted Graphite is available as a Heroku add-on which makes this switch a very smooth and convenient cloud experience.


App names blurred to make it look more interesting.

I created 3 apps on Heroku: one to hold the Hosted Graphite add-on and two others to serve up metrics from Eliq and Telldus respectively. With Hosted Graphite you need to prepend an API key when sending metrics to Graphite, and Heroku (being compliant) uses environment variables,  so I had to update eliq2graphite and telldus2graphite and their dependencies to accommodate this.

Deployment to Heroku is just a matter of pushing code from git:

# setup
heroku git:remote -a <app-name>
# deploy
git push heroku master

The scripts are executed periodically using the Heroku Scheduler add-on:

Screen Shot 2018-02-20 at 15.22.39

Logs can be read with the “heroku logs” command:

 heroku logs -a <app-name>
heroku[scheduler.3876]: Starting process with command `node bin/telldus2graphite.js`
heroku[scheduler.3876]: State changed from starting to up
app[scheduler.3876]: Logged: ["home.chili.temp 10.9 1519109556\n"]
app[scheduler.3876]: Logged: ["home.outdoor.temp -4.7 1519109628\n","home.outdoor.humidity 83 1519109628\n"]
app[scheduler.3876]: Logged: ["home.rain.rrate 0 1519109525\n","home.rain.rtot 206.3 1519109525\n"]
app[scheduler.3876]: Logged: ["home.uv.uv 0 1519109343\n"]
app[scheduler.3876]: Logged: ["home.wind.wdir 292.5 1519109799\n","home.wind.wavg 0 1519109799\n","home.wind.wgust 0 1519109799\n"]
heroku[scheduler.3876]: Process exited with status 0
heroku[scheduler.3876]: State changed from up to complete


Grafana is easy to work with and I’m using single stats and graphs to visualise my metrics.

This slideshow requires JavaScript.

Value mapping, colored thresholds, and units are some of Grafana’s many features.


Oh, I forgot to mention, this setup is completely free. Free as in free 🍺 #winning

Screen Shot 2018-02-20 at 15.24.08

Update: Actually it’s $29/mo for Grafana after the free trial 😬

To be continued 😀 …


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s