From 556132429c671dcbabb395f4d31d7dcb965bae91 Mon Sep 17 00:00:00 2001 From: Dobrica Pavlinusic Date: Thu, 3 Aug 2017 12:16:44 +0200 Subject: [PATCH] create influx format in mqtt which telegraf will pick up --- mqtt-rtl_433-influx.sh | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100755 mqtt-rtl_433-influx.sh diff --git a/mqtt-rtl_433-influx.sh b/mqtt-rtl_433-influx.sh new file mode 100755 index 0000000..de4da0d --- /dev/null +++ b/mqtt-rtl_433-influx.sh @@ -0,0 +1,16 @@ +#!/bin/sh -xe + +mosquitto_sub -t rpi2/rtl433/json \ +| sed --unbuffered -e 's/^[^,]*,//' -e 's/ : /=/g' -e 's/, /,/g' -e 's/}$//' \ +-e 's/ "/ /' -e 's/"=/=/g' -e 's/,"/,/g' \ +-e 's/^ *//' \ +-e 's/ /\\ /g' \ +-e 's/,channel="*\([^,"]*\)"*,/,channel="\1",/' \ +-e 's/,battery="*\([^,"]*\)"*,/,battery="\1",/' \ +-e 's/,id=\([^,]*\),/,id=\1 /' \ +-e 's/^/rtl_433,/' \ +-e 's/"//' \ +-e 's/"//' \ +| tee /dev/stderr \ +| tee /dev/shm/433.influx \ +| mosquitto_pub -t rpi2/rtl_433/influx -l -- 2.20.1