Files
Christoph Petrausch be4af9ff5e Refactor metric extraction from MQTT
This commit allows to extract the metric name from the topic path. Now
it can be configured if all metrics are in a object in a certain topic
or if every topic contains exactly one metric. However, currently these
modes can not be mixed.

This should solve !26

TODO:
* Update documentation
* Add unit tests
2020-11-08 22:01:36 +01:00

29 lines
693 B
Markdown

# Hack Scenarios
Required is a MQTT client. I use this: https://github.com/shirou/mqttcli
## Shelly (Metric Per Topic)
The scenario is the feature requested by issue https://github.com/hikhvar/mqtt2prometheus/issues/26.
To start the scenario run:
```bash
docker-compose --env-file shelly.env up
```
To publish a message run:
```bash
mqttcli pub --host localhost -p 1883 -t shellies/living-room/sensor/temperature '15'
```
## DHT22 (Object Per Topic)
The default scenario
To start the scenario run:
```bash
docker-compose --env-file dht22.env up
```
To publish a message run:
```bash
mqttcli pub --host localhost -p 1883 -t v1/devices/me/test -m '{"temperature":"12", "humidity":21}'
```