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
config.py.sample added license 1 year ago
mqtt-data-exporter.py added license 1 year ago
readme.md added license 1 year ago
requirements.txt import 1 year ago

readme.md

MQTT Data Exporter

Docker

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 MQTTHOST=mqtt.server.ru \
  -e MQTTPORT=1883 \
  -e MQTTUSER=bus \
  -e MQTTPASS=myultrapassword \
  -e EXPOPORT=9021 \
  -e EXPOTIMEOUT=60 \
  -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 config.py.sample and rename it to config.py

mqttCreds = { 
    "hostname":"mqtt.server.ru", 
    "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

License

MQTT-DATA-EXPORTER Copyright © 2018 Vladimir Smagin, http://blindage.org

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 https://www.gnu.org/licenses/.

Questions?

If you have any questions visit http://mqtt-data-exporter.blindage.org or mail me to 21h@blindage.org.