X-Git-Url: https://git.cweiske.de/usb-wde1-tools.git/blobdiff_plain/ef196cc239d5ea63dc602d8392217e4ef2578ad6..fca688e231031d5179fdd26fc9eb91ba26b19b5b:/munin/usb-wde1_ diff --git a/munin/usb-wde1_ b/munin/usb-wde1_ index f58cc9b..4a00adc 100755 --- a/munin/usb-wde1_ +++ b/munin/usb-wde1_ @@ -14,7 +14,7 @@ usb-wde1 - Munin plugin to report usb-wde1 temperature and humidity data =head2 EXAMPLE CONFIGURATION - [usb-wde1_temperature] + [usb-wde1_*] env.logfile /var/log/usb-wde1.log env.host_name House env.sensors 0 1 2 3 4 7 @@ -87,4 +87,30 @@ if [ "$1" = "config" ]; then done exit 0 -fi \ No newline at end of file +fi + +#split by semicolons +OLDIFS="$IFS" +IFS=";" +read -r startzeichen zustand zeitstempel\ + t0 t1 t2 t3 t4 t5 t6 t7\ + h0 h1 h2 h3 h4 h5 h6 h7\ + tc hc ws ns rain checksum\ + < "$logfile" +IFS=$OLDIFS + +#FIXME: check startzeichen +#FIXME: check timestamp + +if [ "$TYPE" = "temperature" ]; then + varprefix=t +else + varprefix=h +fi + + +for i in $sensors; do + eval "value=\$$varprefix$i" + value=`echo $value|sed s/,/./` + echo "sensor$i.value $value" +done