Go to file
kolaente 9de57394c8
fix: set temperature every 5 seconds
2021-10-02 14:41:13 +02:00
.gitignore Add README 2021-10-02 13:47:47 +02:00
LICENSE Add license 2021-10-02 13:30:29 +02:00
README.md Add README 2021-10-02 13:47:47 +02:00
go.mod Add prometheus metrics 2021-10-02 13:39:18 +02:00
go.sum Add prometheus metrics 2021-10-02 13:39:18 +02:00
main.go fix: set temperature every 5 seconds 2021-10-02 14:41:13 +02:00
parse.go fix: set temperature every 5 seconds 2021-10-02 14:41:13 +02:00
parse_test.go Add parser 2021-10-02 13:30:37 +02:00
testsensorfile Add prometheus metrics 2021-10-02 13:39:18 +02:00

README.md

1-wire temperature metrics with prometheus

This is a simple package providing the temperature of a 1-wire sensor such as the DH1820 as prometheus metrics. It reads the w1_slave file at /sys/bus/w1/devices/<sensor>, parses it and provides the read temperature at a webserver running on port 2112 at /metrics.

Usage

Simply run the compiled program and provide the id of the sensor with the -s flag. The id is the name of the folder at /sys/bus/w1/devices/ containing the w1_slave file.

Building

To build this package for the raspberry pi zero:

GOOS=linux GOARCH=arm GOARM=6 go build -o 1-wire-temp-arm

To build for all other Pi's:

GOOS=linux GOARCH=arm GOARM=7 go build -o 1-wire-temp-arm