|
|
7 år sedan | |
|---|---|---|
| README.md | 10 år sedan | |
| init_server.sh | 10 år sedan | |
| jmbp-532.png | 12 år sedan | |
| map | 7 år sedan | |
| mqtt2graphite.py | 7 år sedan | |
| setup.py | 10 år sedan | |
| supervisor.conf | 7 år sedan |
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)
pip install git+https://github.com/jpmens/mqtt2graphite.git
./init_server.sh mqtt.hostname
mqtt.hostname.conf filesupervisord -c /etc/supervisord.conf in your /etc/rc.localmqtt2graphite 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'
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
A lot.