This is an exporter that exposes information gathered from OneWire sensors in Prometheus friendly format.
Before building this exporter you need a working golang development environment. A good starting point is the Golang Getting Started document.
The current build.sh script will build the binary for ARM 5 architecture (good for Raspberry Pi)
go get github.com/cliviu74/onewire-prom-exporter
cd $GOPATH/src/github.com/cliviu74/onewire-prom-exporter
./build.sh
./onewire-prom-exporter
Visit http://localhost:8105/metrics to get metrics from exporter. The exporter will list all sensors and display the metrics as gauges, labeled with device_id (onwire address)
~# curl -s http://localhost:8105/metrics | grep onewire
# HELP onewire_temperature_c Onewire Temperature Sensor Value in Celsius.
# TYPE onewire_temperature_c gauge
onewire_temperature_c{device_id="28-xxxxxxxxxxxx",hostname="pienv"} 29.125
onewire_temperature_c{device_id="28-xxxxxxxxxxxx",hostname="pienv"} 31.812
You can also specify a the web port and metrics path upon launching the exporter
Usage of ./onewire-prom-exporter:
-web.listen-address string
Address and port to expose metrics (default ":8105")
-web.telemetry-path string
Path under which to expose metrics. (default "/metrics")
./onewire-prom-exporter -web.listen-address=0.0.0.0:8105 -web.telemetry-path=/metrics
see examples: here
This is a simple target configuration for prometheus. The ip in the targets array needs to be replaced with the IP of the node running the exporter.
Example config:
scrape_configs:
- job_name: 'onewire_exporter'
scrape_interval: 60s
metrics_path: /metrics
scheme: http
static_configs:
- targets: ['192.168.1.123:8105']
Feel free to report bugs, contribute, discuss changes, fork this project, create pull requests. If you wish to become a contributor, you are welcome to contact me.
Apache License 2.0, see LICENSE.