{"repo":"hikhvar/mqtt2prometheus","free":true,"listed":false,"github":"https://github.com/hikhvar/mqtt2prometheus","clone":"git clone https://github.com/hikhvar/mqtt2prometheus.git","description":"MQTT to Prometheus gateway","language":"Go","stars":427,"topics":["prometheus","mqtt","go","prometheus-metrics","mqtt-topics","tasmota"],"license":"MIT","category":"analytics","readme_excerpt":"MQTT2Prometheus This exporter translates from MQTT topics to prometheus metrics. The core design is that clients send arbitrary JSON messages on the topics. The translation between the MQTT representation and prometheus metrics is configured in the mqtt2prometheus exporter since we often can not change the IoT devices sending the messages. Clients can push metrics via MQTT to an MQTT Broker. This exporter subscribes to the broker and expose the received messages as prometheus metrics. Currently, the exporter supports only MQTT 3.1. I wrote this exporter to expose metrics from small embedded sensors based on the NodeMCU to prometheus. The used arduino sketch can be found in the dht22tomqtt repository. A local hacking environment with mqtt2prometheus, a MQTT broker and a prometheus server is in the hack directory. Assumptions about Messages and Topics This exporter makes some assumptions about the MQTT topics. This exporter assumes that each client publish the metrics into a dedicated topic. The regular expression in the configuration field mqtt.device id regex defines how to extract the device ID from the MQTT topic. This allows an arbitrary place of the device ID in the mqtt topic. For example the tasmota firmware pushes the telemetry data to the topics tele/ /SENSOR . Let us assume the default configuration from configuration file. A sensor publishes the following message to the MQTT topic devices/home/livingroom . This message becomes the following prometheus metrics: The l","default_branch":null,"files":null,"tree":[],"storefront":"/r/hikhvar","claimed":false,"request_supported":{"post":"https://gitbuyer.com/r/hikhvar/mqtt2prometheus/request-supported","requests":0},"note":"indexed from public GitHub; nothing is for sale on this page. Clone it from GitHub. Paid listings live at /search."}