Mqtt2graphite
Subscribe to MQTT topics and push to Graphite's Carbon server
Install / Use
/learn @jpmens/Mqtt2graphiteREADME
mqtt2graphite
This program subscribes to any number of MQTT topics, extracts a value from the messages' payload and sends that off to Graphite via Carbon over a UDP socket.
Values in the payload can be simple numbers (92, 12.7) or JSON strings.
In the latter case, all JSON names/keys are extracted and if their values are
numeric, these are then sent off to Carbon (see example below)

Requirements
- Paho Python MQTT
- A running Carbon/Graphite server with UDP-enabled reception
- Access to an MQTT broker. (I use Mosquitto)
Installation and Configuration
- Configure the mqtt2graphite init script
pip install git+https://github.com/jpmens/mqtt2graphite.git
./init_server.sh mqtt.hostname
Running
- Edit the
mqtt.hostname.conffile - Run or add this cmd
supervisord -c /etc/supervisord.confin your /etc/rc.local
Handling numeric payloads
mqtt2graphite assumes topics defined as "n" in the map file contain a simple
number (integer or float), published thusly:
mosquitto_pub -t test/jp/j1 -m '69'
Handling JSON payloads
mosquitto_pub -t test/jp/j2 -m '{ "size":69,"temp": 89.3, "gas": " 88", "name": "JP Mens" }'
produces the following Carbon keys
test.jp.j2.gas 88.000000 1363169282
test.jp.j2.temp 89.300000 1363169282
test.jp.j2.size 69.000000 1363169282
Todo
A lot.
-
Add configuration file in which we specify username/password and TLS certificates.
-
I'm not experienced enough with high volume of messages, so this should maybe transmit to Carbon via StatsD?
Related Skills
node-connect
352.9kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
frontend-design
111.5kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
openai-whisper-api
352.9kTranscribe audio via OpenAI Audio Transcriptions API (Whisper).
qqbot-media
352.9kQQBot 富媒体收发能力。使用 <qqmedia> 标签,系统根据文件扩展名自动识别类型(图片/语音/视频/文件)。
