Attempting to fix ssh hang in some plugins
authorBrian Flowers <git-admn@bsflowers.net>
Mon, 19 Sep 2016 16:30:59 +0000 (12:30 -0400)
committerBrian Flowers <git-admn@bsflowers.net>
Mon, 19 Sep 2016 16:30:59 +0000 (12:30 -0400)
bdsm.d/df.generic
bdsm.d/sensors.generic
bdsm.sh

index 5ff6f59..113560b 100755 (executable)
@@ -52,7 +52,7 @@ help()
 
 start()
 {
-  running=`ssh $HOSTNAME "cat /home/bdsm/.df.pid | \
+  running=`ssh -q $HOSTNAME "cat /home/bdsm/.df.pid | \
                           xargs ps -T | \
                           grep -v PID | \
                           wc -l"` 2>/dev/null
@@ -66,7 +66,7 @@ start()
     fi
 
     ssh -q $HOSTNAME <<EOF
-    while [ 1 ]; do
+    nohup stdbuf -oL while [ 1 ]; do
       df=`df --output=pcent "$DRIVE" | tail -1 | sed 's/[^0-9]//g'`
       ts=`date '+%s'`
       echo "$ts|$HOSTNAME|DISK-$LABEL-USED|$df" >> $OUTPATH
index 24c82a4..e344890 100755 (executable)
@@ -48,7 +48,7 @@ help()
 
 start()
 {
-  running=`ssh $HOSTNAME "cat /home/bdsm/.sensors.pid | \
+  running=`ssh -q $HOSTNAME "cat /home/bdsm/.sensors.pid | \
                           xargs ps -T | \
                           grep -v PID | \
                           wc -l"` 2>/dev/null
@@ -62,7 +62,7 @@ start()
     fi
 
     ssh -q $HOSTNAME <<EOF
-    while [ 1 ]; do
+    nohup stdbuf -oL while [ 1 ]; do
       ts=`date '+%s'`
       sensors | \
       sed 's/  */ /g' | \
diff --git a/bdsm.sh b/bdsm.sh
index ac2ab78..a923911 100755 (executable)
--- a/bdsm.sh
+++ b/bdsm.sh
@@ -5,7 +5,7 @@
 # Bash Daemon for System Monitoring
 #
 # TODO:
-# 1) Continuing checks (confirm start/stop/config of all plugins)
+# 1) Continuing checks (confirm start/stop/status/config of all plugins)
 # 2) Add 'logger' type and logger plugins
 #       Logger won't hold an SSH connection open
 #       A single host can be defined multiple times as different types
@@ -230,7 +230,7 @@ status()
   while [ $i -lt ${#hosts[@]} ]; do
     type=`echo ${hosts[$i]} | cut -d':' -f1`
     host=`echo ${hosts[$i]} | cut -d':' -f2-`
-    info "Stopping $type monitors on $host..."
+    info "Checking status of $type monitors on $host..."
     functions=`cat /home/bdsm/.bdsm.conf.tmp | grep "$type:$host" | sed 's/.*{\(.*\)}.*/\1/'`
         
     j=0