dht11-exporter/README.md

52 lines
1.6 KiB
Markdown
Raw Normal View History

2022-05-07 21:59:31 +02:00
# Exporter for the DHT11 sensor [![status-badge](https://ci.onders.org/api/badges/finga/dht11-exporter/status.svg)](https://ci.onders.org/finga/dht11-exporter)
A Prometheus exporter for the DHT11 sensor.
## Build
Cargo, the Rust package manager, is used to build this project.
### Same architecture as system
Compile it for the same architecture as the build system:
```sh
cargo build --release
```
### Cross-compile for amd64 (recent RaspberryPi)
Cross-compile it for the amd64 architecture:
```sh
PKG_CONFIG_SYSROOT_DIR=/usr/aarch64-linux-gnu cargo build --target aarch64-unknown-linux-gnu --release
```
## Debian
To build a package for Debian, Raspbian, and so on,
[`cargo-deb`](https://crates.io/crates/cargo-deb) can be used.
The package comes with an automatically started and enabled systemd
service unit which can be configured via
`/etc/default/dht11-exporter`.
### Same architecture as system
Build a `deb` package for the same architecture as the build system:
```sh
cargo deb
```
### Cross-compile for amd64 (recent RaspberryPi)
Build a `deb` package for the amd64 architecture:
```sh
PKG_CONFIG_SYSROOT_DIR=/usr/aarch64-linux-gnu cargo deb --target aarch64-unknown-linux-gnu
```
## Usage
```
USAGE:
dht11-exporter [OPTIONS]
OPTIONS:
-a, --address <ADDRESS> The IPv4 or IPv6 address where the metrics are served [default:
127.0.0.1]
-g, --gpio <GPIO> The GPIO pin of the DHT11 data line [default: 4]
-h, --help Print help information
-p, --port <PORT> The port where the metrics are served [default: 9112]
-V, --version Print version information
```