From: Brian Flowers Date: Fri, 16 Sep 2016 06:56:50 +0000 (-0400) Subject: Added compatibility function to plugins X-Git-Url: http://git.slightlycyberpunk.com%2C%20git.slightlycyberpunk.com/git/?a=commitdiff_plain;h=d2e89a56f2235cab007c69fbe1b63c70d400c182;p=bdsm.git Added compatibility function to plugins --- diff --git a/bdsm.d/df.generic b/bdsm.d/df.generic index 5ccb905..ed8e62d 100755 --- a/bdsm.d/df.generic +++ b/bdsm.d/df.generic @@ -104,6 +104,17 @@ status() fi } +compatible() +{ + compatible="`ssh -q $HOSTNAME 'df --output=pcent /' 2>&1 1>/dev/null`" + if [ "$compatible" != "" ]; then + echo 0 + return + fi + echo 1 + return +} + # UTILITY FUNCTIONS ############################################################################### diff --git a/bdsm.d/sensors.generic b/bdsm.d/sensors.generic index f8f20d3..d92d496 100755 --- a/bdsm.d/sensors.generic +++ b/bdsm.d/sensors.generic @@ -118,6 +118,17 @@ status() fi } +compatible() +{ + compatible="`ssh -q $HOSTNAME 'sensors' 2>&1 1>/dev/null`" + if [ "$compatible" != "" ]; then + echo 0 + return + fi + echo 1 + return +} + # UTILITY FUNCTIONS ############################################################################### diff --git a/bdsm.d/template.generic b/bdsm.d/template.generic index e1fb372..abe8273 100644 --- a/bdsm.d/template.generic +++ b/bdsm.d/template.generic @@ -84,6 +84,11 @@ status() # Check if the monitor is running and echo ON or OFF } +compatible() +{ + # Check if this plugin is compatible with the given host +} + # SCRIPT START ############################################################################### diff --git a/bdsm.d/vmstat.generic b/bdsm.d/vmstat.generic index ad1ac0b..6947ab4 100755 --- a/bdsm.d/vmstat.generic +++ b/bdsm.d/vmstat.generic @@ -69,14 +69,14 @@ start() fi # Check what options awk supports - if [ "`ssh $HOSTNAME \"echo | awk -W interactive '{print 1}' 2>&1 1>/dev/null\"`" != "" ]; then + if [ "`ssh -q $HOSTNAME \"echo | awk -W interactive '{print 1}' 2>&1 1>/dev/null\"`" != "" ]; then awkopt="" else awkopt="-W interactive" fi ssh -q $HOSTNAME <