Adapter to subscribe to mqtt topics and log them into prometheus.
In order to use the adapter, please update the config.yml:
host
: Server ip / urlport
: MQTT Port e.g. 1883topics
: Export name of datapointspath
: Topic name e.g. sensors/temperatureconversion
: optional if you need to extract values from a stringre_pattern
: Regular Expressions filter patternexports
: names of the datapoints as arraymapping
: string to number mapping pairs‚
type
: gauge (default), counterfilter
: regular expressions filter pattern (only for counter)
polling
: Send payload to topics every n secondsinterval
: Send interval in secondstopics
: Array of key-value pairs (- topic: payload)
log_topic_updates
: If true, print all data received on subscribed topics
In some cases you might need to export a .docker precompiled image:
- Compile:
sudo docker buildx build --platform linux/amd64/v2 --tag mqtt-prometheus-adapter .
- Save to file:
sudo docker save -o mqtt-prometheus-adapter.docker mqtt-prometheus-adapter
- Edit read/write rights (optional):
sudo chmod 777 mqtt-prometheus-adapter.docker
You can find more informations about compiling for different plattforms here.