I know there are quite a few people looking for a good way to graph the stats coming from the Pimoroni Enviro+. I thought it would be neat to have a Prometheus exporter, exposing the Enviro+ metrics so it can be scraped by Prometheus and present it using graphs in Grafana. You can find my project on Github and any feedback is greatly appreciated.
I do this via MQTT, Node Red, InfluxDB and Grafana. The graphs show measurements from both an EnviroPlus and an EnviroPhat, which both send their data via MQTT (Mosquitto) to Node Red on an RPi4 where the data is then stored on an InfluxDB on my QNAP NAS and where I run graphs via Grafana that also runs on my QNAP.
If there is interest I can try and describe how I’ve done this but it’s rather complex as you can maybe imagine, so I have to think about what would be a clear and concise way to describe it.
Let me know if I can help :). And I’m sure you can make these graphs from the data you gather with Prometheus, maybe I can share my dashboard for you to have a look at. Not sure yet how that works, sharing dashboards in Grafana.
MQTT and NodeRed are used for the network transportation of the gathered data and then re-formatting that data into the appropriate fields for storage in an InfluxDB. Maybe Prometheus does this already and I’ve reinvented the wheel :P LOL.
Getting the measurements from multiple targets is the hardest part I guess and Prometheus does a good job in that. As I wanted to get experienced with Prometheus I wrote this exporter. Advantages are that scraping targets (multiple Raspberry Pi’s for instance) is a very lightweight process and scales well.
I really like your approach though as it seems to be somewhat more IoT like ;). Definitely interested in having a look at your MQTT and NodeRed code if you have it published.
I went the IoT route indeed as MQTT is now the default standard to exchange messages between IoT devices. But that’s also the only thing it does, it exchanges messages but it’s up to you to do something with those messages, or not. So that’s why I used NodeRed to take those incoming messages and store them into an InfluxDB. The nice thing about NodeRed is that it has many input- and output interfaces which makes it ideal for what I intended (which is interpret the incoming message and store it into a database).
I just read up a little bit about Prometheus and watched some videos so now I will definitely check out your exporter because I was wondering how you got the data from the sensor into Prometheus :).
I’d be very grateful, if you could explain in detail just how to get the MQTT out of the EnviroPlus. I’m quite familiar with the MQTT - NodeRed - Grafana setup having used it with few projects.
Can you please share the details of how you were able to get your Enviro+ data into Influxdb ? I have a local instance of Influxdb running on a separate instance to my Raspberry Pi.
I’m new to all this so I am probably missing something. I have a basic setup. I run a python script that reads the sensor values every 30min and publish them via mqtt I’m parallel I have a second python script that subscribes to the mqtt data and stores it in an influx dB and I then graph the data in grafana. I can’t work out what advantages Prometheus brings…