Designing Data-Intensive Application, aka “The Boar Book” (kabanchik)
iptables -t nat -A PREROUTING -i br-lan -p tcp -d qing.cleargrass.com --dport 11883 -j DNAT --to-destination 127.0.0.1:11883
3. Added a cron job of periodic subscribing for air monitor data. Without this message it doesn't push the data. The topic consists of some base64 uid and air monitor MAC address, I wrote it in square brackets, should be changed by end user: */5 * * * * /usr/bin/mosquitto_pub -h 127.0.0.1 -p 11883 -t '/[uid]/[mac]/user/get' -m '{"duration":"303","up_itvl":"2","type":"12"}'
4. Configured a mqtt_consumer in telegraf: [[inputs.mqtt_consumer]]
servers = ["tcp://127.0.0.1:11883"]
name_override = "air_monitor"
topics = [
"/+/+/user/update",
]
data_format = "json"
tag_keys = [
"mac",
]
5. Created graphs and alerts in grafana. It was easier for me to create a further automation from there.