Fixing timestamp issues in df, sensors plugins
authorBrian Flowers <git-admn@bsflowers.net>
Wed, 21 Sep 2016 17:54:46 +0000 (13:54 -0400)
committerBrian Flowers <git-admn@bsflowers.net>
Wed, 21 Sep 2016 17:54:46 +0000 (13:54 -0400)
bdsm.d/df.generic
bdsm.d/sensors.generic
bdsm.d/sqlite3.processor
bdsm.sh

index ea3d8fc..c68abd9 100755 (executable)
@@ -67,8 +67,8 @@ start()
 
     ssh -q $HOSTNAME <<EOF
     while [ 1 ]; do
-      df=`df --output=pcent "$DRIVE" | tail -1 | sed 's/[^0-9]//g'`
-      ts=`date '+%s'`
+      df=\`df --output=pcent "$DRIVE" | tail -1 | sed 's/[^0-9]//g'\`
+      ts=\`date '+%s'\`
       stdbuf -oL echo "\$ts|$HOSTNAME|DISK-$LABEL-USED|\$df"
       sleep $DELAY
     done >> $OUTPATH &
index d39fa9b..85e7e4e 100755 (executable)
@@ -63,7 +63,7 @@ start()
 
     ssh -q $HOSTNAME <<EOF
     while [ 1 ]; do
-      ts=`date '+%s'`
+      ts=\`date '+%s'\`
       stdbuf -o0 sensors | \
       sed 's/  */ /g' | \
       sed 's/[(].*[)]//g' \
index 63b9af6..076b0f4 100644 (file)
@@ -54,7 +54,7 @@ start()
   
   cat /home/bdsm/in.fifo | awk -F'|' '{ \
     printf("INSERT INTO MEASUREMENTS(timestamp,host,attribute,value) \
-      VALUES (%s,\"%s\", \"%s\", \"%s\"); COMMIT;\n",$1,$2, $3, $4) }' | \
+      VALUES (%s,\"%s\", \"%s\", \"%s\");\n",$1,$2, $3, $4) }' | \
   sqlite3 bdsm.sqlite3 &
   echo $! > /home/bdsm/.processor.pid
 }
diff --git a/bdsm.sh b/bdsm.sh
index 85f4309..126660e 100755 (executable)
--- a/bdsm.sh
+++ b/bdsm.sh
@@ -47,8 +47,8 @@ failure()
 # VARIABLES
 ###############################################################################
 
-if [ -f "/home/bdsm/bdsm.d/$1.processor" ]; then
-  processor="${1}"
+if [ -f "/home/bdsm/bdsm.d/$2.processor" ]; then
+  processor="${2}"
 else
   processor=""
 fi