In this article, we will set up a DHT22/AM2302 sensor on a Raspberry Pi. This sensor connects to a GPIO pin and reports temperature and humidity data. We’ll see how to connect it to the Raspberry Pi and confirm the data acquisition.
Wouldn’t it be better to centralize all our metrics in one place? Well, we’ll code a Prometheus exporter using the Golang language. Prometheus is an open-source project for monitoring and alerting using a time-series database.
An exporter exposes the metrics via an HTTP server using the expected format. The Prometheus server calls the exporter to collect and stores the metrics. You can then query and define alerts from the metrics. Prometheus is pluggable to other systems as Grafana to create metric visualizations.
Alright! This is exactly what we’ll do here finally. After installing the exporter, we’ll configure Prometheus and Grafana to work together. We’ll able to centralize the metrics and visualize them in a beautiful dashboard.
The AM2302 is a wired version of the DHT22 sensor. From the datasheet it presents the following characteristics:
#technology #golang #programming