Open Simoliv opened 1 year ago
I don't think this is documented anywhere, but the default configuration assumes the values coming from mqtt are json. Since you have only single metric values, you need to set metric_per_topic_config
in your config.yaml
. That expects a single key called metric_name_regex
that contains a regex that runs on the topic to produce the metric name. It must have a named group for metricname
.
I haven't tested this, but I'm guessing adding something like this might work.
mqtt:
metric_per_topic_config:
metric_name_regex: (.*/)?(?P<metricname>.*)
Have a look around config.go
for more info.
Also, have a look at https://github.com/hikhvar/mqtt2prometheus/issues/96, it's a similar issue
HI there,
please apologize, I seem to be unable to find thr right settings for the exporter .. But .. the documentation could be a bit clearer IMO, some more examples would helped me maybe.
Can anybody guide me in the right direction ? I am having
in mosquitto, and would like to get that into prometheus .. What does my config.yaml need to look like ? The best I was able to achieve was a
2022-10-16T16:39:43Z error cmd/mqtt2prometheus.go:158 Error while processing message {"error": "could not store metrics '275.798' on topic hoymiles/111816703175/total: failed to extract metric values from topic: failed to find valid metric in topic path"}
and some more of this kind of messages..
any help would really be appreciated, best regards