mqtt2graphite fork

root c85ed92b65 update sht30 7 years ago
README.md c3c177e317 Add init script & supervisor for running in daemon mode 9 years ago
init_server.sh 002d1ad31a typo 9 years ago
jmbp-532.png d1d3566b50 Add obligatory screenshot 12 years ago
map 5e0fbc7ea5 Adding poor AM2301 support for Sonoff Tasmota firmware 7 years ago
mqtt2graphite.py c85ed92b65 update sht30 7 years ago
setup.py c3c177e317 Add init script & supervisor for running in daemon mode 9 years ago
supervisor.conf 04a2c390b5 Updating supervisor conf 7 years ago

README.md

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

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.conf file
  • Run or add this cmd supervisord -c /etc/supervisord.conf in 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?