Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/guivin/dht-prometheus-exporter
A Prometheus exporter for DHT22/AM2302 sensor runnable on a Raspberry Pi
https://github.com/guivin/dht-prometheus-exporter
golang-application prometheus raspberry
Last synced: 18 days ago
JSON representation
A Prometheus exporter for DHT22/AM2302 sensor runnable on a Raspberry Pi
- Host: GitHub
- URL: https://github.com/guivin/dht-prometheus-exporter
- Owner: guivin
- Created: 2021-02-17T07:26:42.000Z (almost 4 years ago)
- Default Branch: main
- Last Pushed: 2024-02-05T20:05:59.000Z (11 months ago)
- Last Synced: 2024-11-15T03:14:52.593Z (about 1 month ago)
- Topics: golang-application, prometheus, raspberry
- Language: Go
- Homepage: https://medium.com/towards-artificial-intelligence/monitor-home-temperature-and-humidity-with-a-raspberry-pi-and-prometheus-e863c62b6219
- Size: 8.79 KB
- Stars: 3
- Watchers: 2
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# DHT Prometheus Exporter
> A Prometheus exporter for DHT22/AM2302 sensors runnable on Raspberry PiThis repository contains a Prometheus exporter designed for the DHT22/AM2302 temperature and humidity sensors, optimized
for use on Raspberry Pi devices.## Prerequisites
Before you begin, ensure you have the necessary tools and dependencies installed:
* Install Golang and set up your environment variables:
```
sudo apt-get install golang
export GOPATH="$HOME/go"
export GOBIN="$GOPATH/bin"
export PATH="$PATH:$GOBIN"
```* Make: Required for building the source code:
```
sudo apt install make
```* Dep: Golang's dependency management tool:
```
go get -u github.com/golang/dep/cmd/dep
```## Installation
Follow these steps to install the DHT Prometheus Exporter on your Raspberry Pi:
1. Download the project:
```
go get -u github.com/guivin/dht-prometheus-exporter
cd $GOPATH/src/github.com/guivin/dht-prometheus-exporter
```2. Build and install the project:
```
make all
```3. Create a dedicated system user that belongs to the gpio group (for GPIO pin access):
```
useradd --user-group --groups gpio --no-create-home --system --shell /usr/sbin/nologin dht-prometheus-exporter
```4. Set up the configuration file. Copy the default configuration file and modify it according to your needs:
```
cp dht-prometheus-exporter.yml /etc/dht-prometheus-exporter.yml
sudo chown dht-prometheus-exporter:dht-prometheus-exporter /etc/dht-prometheus-exporter.yml
sudo chmod 0640 /etc/dht-prometheus-exporter.yml
```5. Integrate with systemd for easy service management:
```
cp dht-prometheus-exporter.service /etc/systemd/system
sudo systemctl daemon-reload
sudo systemctl start dht-prometheus-exporter
```## Usage
Retrieve the metrics from the exporter by querying the designated HTTP endpoint (adjust the port if
your configuration differs):```http
GET http://localhost:8080/metrics
```This command will output the current readings from your DHT22/AM2302 sensors, making the data available for Prometheus
scraping and subsequent analysis or visualization.