mirror of
https://codeberg.org/icewind/mitemp-prometheus.git
synced 2026-06-03 09:04:13 +02:00
updates
This commit is contained in:
parent
a501b3c4c3
commit
7c3d4a7867
10 changed files with 1435 additions and 653 deletions
37
README.md
37
README.md
|
|
@ -4,6 +4,29 @@ Expose Xiaomi MI Temperature and Humidity Sensor to prometheus
|
|||
|
||||
## Usage
|
||||
|
||||
Configuration can be done by either a config file or environment variables.
|
||||
|
||||
### Usage with a config file
|
||||
|
||||
Create a `config.toml` like
|
||||
|
||||
```toml
|
||||
[listen]
|
||||
port = 3030
|
||||
|
||||
[names]
|
||||
"58:2D:34:39:1A:01" = "Sensor 1"
|
||||
"58:2D:34:39:1A:02" = "Sensor 2"
|
||||
```
|
||||
|
||||
And tun the binary like
|
||||
|
||||
```
|
||||
mitemp-prometheus config.toml
|
||||
```
|
||||
|
||||
### Usage with environment variables
|
||||
|
||||
Run the binary with the following environment variables
|
||||
|
||||
```dotenv
|
||||
|
|
@ -11,6 +34,8 @@ PORT=3030
|
|||
NAMES="58:2d:34:39:1a:01=Sensor 1,58:2d:34:39:1a:02=Sensor 2"
|
||||
```
|
||||
|
||||
### Querying metrics
|
||||
|
||||
The prometheus metrics will be available at `localhost:3030/metrics`
|
||||
|
||||
```
|
||||
|
|
@ -20,20 +45,18 @@ sensor_humidity{name="Sensor 1", mac="58:2d:34:39:1a:01"} 59.2
|
|||
sensor_battery{name="Sensor 2", mac="58:2d:34:39:1a:02"} 100
|
||||
sensor_temperature{name="Sensor 2", mac="58:2d:34:39:1a:02"} 16
|
||||
sensor_humidity{name="Sensor 2", mac="58:2d:34:39:1a:02"} 55.9
|
||||
sensor_battery{mac="58:2d:34:39:1a:03"} 100
|
||||
sensor_temperature{mac="58:2d:34:39:1a:03"} 16.1
|
||||
sensor_humidity{mac="58:2d:34:39:1a:03"} 55.3
|
||||
```
|
||||
|
||||
## License
|
||||
|
||||
Licensed under either of
|
||||
* Apache License, Version 2.0 ([LICENSE-APACHE](LICENSE-APACHE) or http://www.apache.org/licenses/LICENSE-2.0)
|
||||
* MIT license ([LICENSE-MIT](LICENSE-MIT) or http://opensource.org/licenses/MIT)
|
||||
at your option.
|
||||
|
||||
- Apache License, Version 2.0 ([LICENSE-APACHE](LICENSE-APACHE) or http://www.apache.org/licenses/LICENSE-2.0)
|
||||
- MIT license ([LICENSE-MIT](LICENSE-MIT) or http://opensource.org/licenses/MIT)
|
||||
at your option.
|
||||
|
||||
### Contribution
|
||||
|
||||
Unless you explicitly state otherwise, any contribution intentionally submitted
|
||||
for inclusion in the work by you shall be dual licensed as above, without any
|
||||
additional terms or conditions.
|
||||
additional terms or conditions.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue