All Projects → turmoni → temp-probe-exporter

turmoni / temp-probe-exporter

Licence: MIT license
Export Prometheus data from 1-Wire temperature sensors, using an Arduino or Linux system

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to temp-probe-exporter

bash-exporter
Simple & minimalistic Prometheus exporter for bash scripts, written in Go
Stars: ✭ 54 (+217.65%)
Mutual labels:  prometheus-exporter
prometheus-kafka-consumer-group-exporter
Prometheus Kafka Consumer Group Exporter
Stars: ✭ 72 (+323.53%)
Mutual labels:  prometheus-exporter
pgbouncer exporter
Prometheus exporter for Pgbouncer metrics.
Stars: ✭ 19 (+11.76%)
Mutual labels:  prometheus-exporter
unpoller
Application: Collect ALL UniFi Controller, Site, Device & Client Data - Export to InfluxDB or Prometheus
Stars: ✭ 1,613 (+9388.24%)
Mutual labels:  prometheus-exporter
cryptoprom
CryptoProm is a Prometheus metrics exporter for Cryptocurrency market prices.
Stars: ✭ 19 (+11.76%)
Mutual labels:  prometheus-exporter
azure-devops-exporter
Prometheus exporter for Azure DevOps (VSTS) including agent pools, builds, releases, deployments, pullrequests and repo stats
Stars: ✭ 102 (+500%)
Mutual labels:  prometheus-exporter
cassandra-exporter
Java agent for exporting Cassandra metrics to Prometheus
Stars: ✭ 59 (+247.06%)
Mutual labels:  prometheus-exporter
azure-metrics-exporter
Azure Monitor metrics exporter for Prometheus with dimension support, template engine and ServiceDiscovery
Stars: ✭ 54 (+217.65%)
Mutual labels:  prometheus-exporter
hue exporter
A Prometheus exporter for Philips Hue (written in Go)
Stars: ✭ 109 (+541.18%)
Mutual labels:  prometheus-exporter
egg-exporter
Egg.js 的 Prometheus 指标收集插件,附带 Grafana 看板。
Stars: ✭ 24 (+41.18%)
Mutual labels:  prometheus-exporter
bigip exporter
Prometheus exporter for BIG-IP metrics
Stars: ✭ 83 (+388.24%)
Mutual labels:  prometheus-exporter
aerospike exporter
A prometheus exporter for collecting aerospike metrics
Stars: ✭ 13 (-23.53%)
Mutual labels:  prometheus-exporter
pve exporter
Prometheus exporter for Proxmox VE.
Stars: ✭ 31 (+82.35%)
Mutual labels:  prometheus-exporter
prometheus-sentry-exporter
Exports sentry project metrics for prometheus.
Stars: ✭ 32 (+88.24%)
Mutual labels:  prometheus-exporter
kafka-consumer-lag-monitoring
Client tool that exports the consumer lag of Kafka consumer groups to Prometheus or your terminal
Stars: ✭ 45 (+164.71%)
Mutual labels:  prometheus-exporter
tplink-plug-exporter
TP-Link Smart Plug Prometheus Exporter
Stars: ✭ 80 (+370.59%)
Mutual labels:  prometheus-exporter
vmware exporter
VMWare VCenter Exporter for Prometheus
Stars: ✭ 46 (+170.59%)
Mutual labels:  prometheus-exporter
opentracing-metrics-tracer
Exports cross-process metrics via OpenTracing to Prometheus.
Stars: ✭ 13 (-23.53%)
Mutual labels:  prometheus-exporter
modbus exporter
Exporter which retrieves stats from a modbus system and exports them via HTTP for Prometheus consumption.
Stars: ✭ 16 (-5.88%)
Mutual labels:  prometheus-exporter
vrops-exporter
Prometheus exporter running python to get metrics out of VMware vRealize Operations
Stars: ✭ 16 (-5.88%)
Mutual labels:  prometheus-exporter

temp-probe-exporter

Code I use to read temperature data from 1-Wire temperature sensors and spit it out as Prometheus metrics, with a snappy name.

There are two core pieces here:

  • An Arduino sketch to query sensors
  • A Python Prometheus exporter for sensor data, either from an Arduino, or running directly on a Raspberry Pi
    • This has been tested with Python 2.7 (w1) and 3.6 (serial), requires yaml and pyserial

Note that I am assuming familiarity with Prometheus, learning how to configure it is outside of the scope of this project (but isn't all that difficult to do for a trivial configuration).

Hardware setup

Using with an Arduino

The Arduino sketch cycles through all connected temperature sensors and writes their values out via the serial port, in the form of:

SENSOR_ID:Temp(C)

To attach 1-Wire sensors to the Arduino, simply do the following:

  • Put a 4.7k resistor between +5v and your data pin (2 by default)
  • Attach the data wire from your sensor(s) to the data pin (obviously can be via a breadboard or similar)
  • Attach the other two wires to GND

If you want to use a different data pin or change the precision, then this can be changed via #defines at the top of the file. Also, if you want to try using more than 20 sensors (note: the most I've attempted is 3) then you'll need to make the probes array bigger.

To test that it's working, attach to the serial port exposed by the Arduino. It should be printing out temperature readings.

If you don't know your sensor IDs (a 16-character hexadecimal string), either try them one at a time, or heat/cool one at a time and make a note of which changes.

Using with a Raspberry Pi (Zero W)

As with the Arduino:

  • Hook up a 4.7k resistor between +5v and your data pin (BCM4 by default, see https://pinout.xyz/pinout/1_wire for details)
  • Attach the data wire from your sensor(s) to the data pin
  • Attach the other two wires to GND

You will also need to add the following to /boot/config.txt:

dtoverlay=w1-gpio,pullup=on

On powering up your Pi with the sensors connected, you should find /sys/bus/w1/devices/ is populated. To get the device ID of a given entry, run:

hd /sys/bus/w1/devices/<device>/id

To test the temperature sensing:

cat /sys/bus/w1/devices/<device>/w1_slave

This will output two lines. The temperature is at the end of the second line, in millidegrees C. If this doesn't look right, you may need to find out why.

Using the exporter

The exporter is configured via a (fairly simple) YAML file. An example is provided.

You will need to set sensor_mappings to match your set of sensors. This is a dictionary of (uppercase) sensor ID to location mappings. The locations are used in a Prometheus label.

You will probably also need to configure the access to the temperature sensor. For a serial connection to an Arduino, set method to serial, and serial_port to your serial device. For a direct Linux setup (e.g. a Raspberry Pi), simply set method to w1.

Finally, the default port is 8104, in order to avoid clashing with real exporters by real people. If you want to change it, set exporter_port.

Simply run the exporter as /path/to/prometheus_exporter.py /path/to/prometheus_exporter.yaml. A systemd unit file is also provided. The process does not daemonise.

Notes

Yes, the metric name is terrible and lacks flexibility (onewire_temperature_c). I am sure in the future I'll have a non-onewire device using the same metric name and I will curse myself.

The code is probably terrible, it has been quickly thrown together for something that works, because it is hot right now and I want to be able to graph that.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].