MQTT Data Exporter for Prometheus. Exports any message convertible to float from MQTT to prometheus.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Vladimir Smagin a14a07d7f6 added license 1 year ago
.gitignore import 1 year ago
Dockerfile some fixes 1 year ago added license 1 year ago added license 1 year ago added license 1 year ago
requirements.txt import 1 year ago

MQTT Data Exporter


USE_ENV_VARS=1 is required to run with variables from envieronment. If you set up MQTTHOST then you must also set up MQTTPORT, MQTTUSER, MQTTPASS. Another variables not required.

docker run --name mqttde_container -d \
  -e USE_ENV_VARS=1 \
  -e \
  -e MQTTPORT=1883 \
  -e MQTTUSER=bus \
  -e MQTTPASS=myultrapassword \
  -e EXPOPORT=9021 \
  -p 9021:9021 iam21h/mqtt-data-exporter

Or build it by hands

docker build -t mqttde .

Hard way

Install python 3, pip3 and requirements

pip3 install --no-cache-dir -r requirements.txt

Configure and rename it to

mqttCreds = { 
    "port": 1883,
    "auth": { "username":"bus", "password":"myultrapassword" }

# listening port. yes, 21 is in my nick :)
exporterPort = 9021

# seconds before reconnection
# I'm sure 60 is enought
reconnectTime = 60


MQTT-DATA-EXPORTER Copyright © 2018 Vladimir Smagin,

This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see


If you have any questions visit or mail me to