Yesterday, I started to annoy my colleagues by flooding our Slack channel with messages demanding to let some fresh air in when the air quality drops.
Somehow this drew more attention than I expected, and people wanted to know how it works. So here is a quick summary.
The other day, when my colleagues had a long discussion about how to properly air out a room by arguing about miscalculated water vapor data, I thought of one of my side projects that could actually be useful in our office.
It started a while ago because I wanted to learn Rust (a very beautiful programming language btw.) and also wanted to revisit InfluxDB and Grafana, monitoring solutions I had introduced for a customer project two years ago.
So I wrote a tiny Rust program which reads the CO2 value from a sensor connected to a Raspberry Pi. All it does is reading the register values and writing them to stdout:
Everything else I needed was already there:
Telegraf is a small agent developed by InfluxData which is able to regularly execute a process and store its output into InfluxDB.
influxdb is a time series database with a powerful query language. I then used moving-average which helps to even out spikes.
Grafana is a tool to visualize your data. It comes with basic support functionality for alerts and can send slack notifications via incoming web hooks. And it make it very easy to upload images of your charts to your cloud storage or WebDAV, so you can immediately see what’s wrong, or share the graph without any singe-page app hassle.
Playing with Rust is fun and deploying a monitoring solution is a lot easier now than it was two years ago.