Data extraction issue
kylhuk opened this issue · 3 comments
kylhuk commented
Hey there,
I freshly set up mqtt2prometheus
with all the proper configs, and everything seems to work just fine. Somehow I'm not able to find the metrics I try to extract inside prometheus
.
Extract of config.yaml
topic_path: home/ruuvi/+/sensor/+
device_id_regex: "home/ruuvi/(?P<deviceid>.*)/sensor/(?P<metricname>.*)"
metrics:
- prom_name: temperature
mqtt_name: temperature
type: gauge
const_labels:
sensor_type: ruuvitag
Debug message of mqtt2prometheus
:
2021-08-04T20:35:29Z debug metrics/ingest.go:42 Got message {"topic": "home/ruuvi/FD-A6-86-79-13-C0/sensor/temperature", "payload": "21.34"}
Message visible in /metrics
of prometheus
received_messages{status="success",topic="home/ruuvi/FD-A6-86-79-13-C0/sensor/temperature"} 99
And yet I'm not able to find any mqtt2prometheus-metrics on prometheus. The only metric available is mqtt2prometheus_connected
Any hints where I did a mistake?
genkobar commented
Using regex capture groups for both device ID and metric name requires a bit different syntax:
topic_path: shellies/+/sensor/+
device_id_regex: "shellies/(?P<deviceid>.*)/sensor"
metric_per_topic_config:
metric_name_regex: "shellies/(?P<deviceid>.*)/sensor/(?P<metricname>.*)"
...
metrics:
Take a look at the ReadMe file here:
https://github.com/hikhvar/mqtt2prometheus/tree/master/hack
I've not used this myself, but good luck!
hikhvar commented