Code Monkey home page Code Monkey logo

dht22_exporter's Introduction

DHT22 prometheus exporter

The DHT22 is a cheap "DIY" sensor for microcontrollers (arduino, rpi)

This repository creates a prometheus exporter so that metrics can be collected and displayed.

Grafana graph of metrics collected View above dashboard json here.

Example of exported metrics

...
# HELP dht22_temperature_celsius Temperature in celsius provided by dht sensor
# TYPE dht22_temperature_celsius gauge
dht22_temperature_celsius 22.8
# HELP dht22_temperature_fahrenheit Temperature in fahrenheit provided by dht sensor
# TYPE dht22_temperature_fahrenheit gauge
dht22_temperature_fahrenheit 73.0
# HELP dht22_humidity Humidity in percents provided by dht sensor
# TYPE dht22_humidity gauge
dht22_humidity 48.8

Local Testbed

  • Raspberry pi 3
  • DHT22 Sensor
    • The one linked above comes with built in resistor

Install on Raspbian

  • Copy the python file to the path you want to keep it. ex: /usr/local/bin
  • Go to that path and install dependencies: sudo pip3 install -r requirements.txt
  • Assuming the use of systemd, copy the service file at dht22-exporter.service to /etc/systemd/system and daemon-reload systemd. You might want to also enable the service so that it persists after a reboot: sudo systemctl enable dht22-exporter.service.
  • In this service file some default values for the pin and polling rate Ex: ./dht22_exporter 4 2, change these values to align with what ever your board setup is.
  • If you're not running systemd, figure out a way to run the python file continuously (through screen, as a service, etc).
  • Start the dht22-exporter service and point prometheus at port 8001.

Known Issues

  • The sensor sometimes gives wildly inaccurate readings (5000% humidity), this should be mitigated by some checks in the code, but ~1% of sensor readings may not be even close to accurate.

Authors

dht22_exporter's People

Contributors

clintjedwards avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.