diff --git a/plugins/arp/arp b/plugins/arp/arp index 896b38bb..0dee771d 100755 --- a/plugins/arp/arp +++ b/plugins/arp/arp @@ -15,10 +15,11 @@ if [ "$1" = "autoconf" ]; then # Search for arp - which arp >/dev/null 2>/dev/null || (echo "no (can't find arp binary)" && exit 1) - - # ...or success - echo yes + if which arp >/dev/null; then + echo yes + else + echo "no (missing 'arp' executable)" + fi exit 0 fi diff --git a/plugins/arp/arp_ b/plugins/arp/arp_ index f85865b4..979d9a57 100755 --- a/plugins/arp/arp_ +++ b/plugins/arp/arp_ @@ -19,13 +19,11 @@ case "$1" in autoconf) # Search for ip - which ip >/dev/null 2>&1 - if [ $? -ne 0 ]; then - echo "no (can't find ip binary)" - exit 1 + if which ip >/dev/null; then + echo 'yes' + else + echo "no (missing 'ip' executable)" fi - # ...or success - echo 'yes' exit 0 ;; suggest) diff --git a/plugins/backuppc/backuppc b/plugins/backuppc/backuppc index ea5f3cf8..db74d222 100755 --- a/plugins/backuppc/backuppc +++ b/plugins/backuppc/backuppc @@ -18,9 +18,12 @@ HOSTS=$(cd ${PCDIR} 2>/dev/null && ls -1) . $MUNIN_LIBDIR/plugins/plugin.sh if [ "$1" = "autoconf" ]; then - [ ! -z "${HOSTS}" ] && echo "yes" && exit 0 - echo "no" - exit 1 + if [ -n "$HOSTS" ]; then + echo "yes" + else + echo "no" + fi + exit 0 fi if [ "$1" = "config" ]; then diff --git a/plugins/google/google-rank b/plugins/google/google-rank index 9c6cba45..e941940f 100755 --- a/plugins/google/google-rank +++ b/plugins/google/google-rank @@ -40,14 +40,12 @@ # Auto Configure, Check it word 1 is defined if [ "$1" = "autoconf" ]; then - if [ "$URL1" != "" ]; then - if [ "$WORD1" != "" ]; then - echo yes - exit 0 - fi + if [ -n "$URL1" ] && [ -n "$WORD1" ]; then + echo yes + else + echo no fi - echo no - exit 1 + exit 0 fi #Configure, loop through each variable defined WORDx URLx dumping it to munin diff --git a/plugins/jvm/jstat__gccount b/plugins/jvm/jstat__gccount index a04eb638..a6eae247 100755 --- a/plugins/jvm/jstat__gccount +++ b/plugins/jvm/jstat__gccount @@ -110,15 +110,13 @@ if [ "$1" = "autoconf" ]; then if [ ! -x "${JAVA_HOME}/bin/jstat" ]; then echo "no (No jstat found in ${JAVA_HOME}/bin)" - exit 1 + elif [ ! -f "$pidfilepath" ]; then + echo "no (missing file $pidfilepath)" + elif [ ! -r "$pidfilepath" ]; then + echo "no (cannot read $pidfilepath)" + else + echo "yes" fi - - if [ ! -f "${pidfilepath}" ] || [ ! -r "${pidfilepath}" ]; then - echo "no (No such file ${pidfilepath} or cannot read ${pidfilepath}" - exit 1 - fi - - echo "yes" exit 0 fi diff --git a/plugins/jvm/jstat__gctime b/plugins/jvm/jstat__gctime index 7326b46b..21cdec82 100755 --- a/plugins/jvm/jstat__gctime +++ b/plugins/jvm/jstat__gctime @@ -130,15 +130,13 @@ if [ "$1" = "autoconf" ]; then if [ ! -x "${JAVA_HOME}/bin/jstat" ]; then echo "no (No jstat found in ${JAVA_HOME}/bin)" - exit 1 + elif [ ! -f "$pidfilepath" ]; then + echo "no (missing file $pidfilepath)" + elif [ ! -r "$pidfilepath" ]; then + echo "no (cannot read $pidfilepath)" + else + echo "yes" fi - - if [ ! -f "${pidfilepath}" ] || [ ! -r "${pidfilepath}" ]; then - echo "no (No such file ${pidfilepath} or cannot read ${pidfilepath}" - exit 1 - fi - - echo "yes" exit 0 fi diff --git a/plugins/jvm/jstat__heap b/plugins/jvm/jstat__heap index edf6f411..d6739662 100755 --- a/plugins/jvm/jstat__heap +++ b/plugins/jvm/jstat__heap @@ -185,15 +185,13 @@ if [ "$1" = "autoconf" ]; then if [ ! -x "${JAVA_HOME}/bin/jstat" ]; then echo "no (No jstat found in ${JAVA_HOME}/bin)" - exit 1 + elif [ ! -f "$pidfilepath" ]; then + echo "no (missing file $pidfilepath)" + elif [ ! -r "$pidfilepath" ]; then + echo "no (cannot read $pidfilepath)" + else + echo "yes" fi - - if [ ! -f "${pidfilepath}" ] || [ ! -r "${pidfilepath}" ]; then - echo "no (No such file ${pidfilepath} or cannot read ${pidfilepath}" - exit 1 - fi - - echo "yes" exit 0 fi diff --git a/plugins/memory/kmemsum b/plugins/memory/kmemsum index 6101d1c0..a09a0fa8 100755 --- a/plugins/memory/kmemsum +++ b/plugins/memory/kmemsum @@ -16,18 +16,15 @@ if [ "$1" = "autoconf" ]; then if [ -x /sbin/sysctl ]; then - /sbin/sysctl vm.kmem_size_max > /dev/null - if [ $? = "0" ]; then - echo yes - exit 0 - else - echo no - exit 1 - fi + if /sbin/sysctl vm.kmem_size_max >/dev/null 2>&1; then + echo "yes" + else + echo "no (missing sysctl variable 'vm.kmem_size_max')" + fi else - echo no - exit 1 + echo "no (missing 'sysctl' executable)" fi + exit 0 fi TEXT=`kldstat | tr a-f A-F | awk 'BEGIN {print "ibase=16"}; NR > 1 {print $4}' | bc | awk '{a+=$1}; END {print a}'` diff --git a/plugins/mpd/mpdstats_ b/plugins/mpd/mpdstats_ index f9d0360a..a3b336bc 100755 --- a/plugins/mpd/mpdstats_ +++ b/plugins/mpd/mpdstats_ @@ -83,15 +83,11 @@ ACTION="$(basename "$0" | sed 's/^.*_//')" do_autoconf () { if [ -z "$NCBIN" ] ; then echo "no (missing netcat program ('nc'))" - exit 1 - fi - - if ! echo version | "$NCBIN" "$MPDHOST" "$MPDPORT" >/dev/null 2>&1; then + elif ! echo version | "$NCBIN" "$MPDHOST" "$MPDPORT" >/dev/null 2>&1; then echo "no (connection failed)" - exit 1 + else + echo "yes" fi - - echo "yes" exit 0 } diff --git a/plugins/mythtv/dvb-signal b/plugins/mythtv/dvb-signal index aeaa2ebb..f3e70e43 100755 --- a/plugins/mythtv/dvb-signal +++ b/plugins/mythtv/dvb-signal @@ -18,19 +18,15 @@ Tuner=0 case $1 in autoconf|detect) - REQ=`which femon` - if [ "$REQ" = "" ]; then + if ! which femon >/dev/null; then echo "no (femon not installed)" - exit 1 - fi - - if [ -e /dev/dvb/adapter$Tuner/ ]; then + elif [ -e "/dev/dvb/adapter$Tuner/" ]; then echo yes - exit 0 else echo "no (dvb tuner $Tuner not found)" - exit 1 - fi;; + fi + exit 0 + ;; config) echo "graph_title DVB signal strength" diff --git a/plugins/network/brc_rssi b/plugins/network/brc_rssi index 01c76325..146bdc87 100755 --- a/plugins/network/brc_rssi +++ b/plugins/network/brc_rssi @@ -77,11 +77,11 @@ EOF do_autoconf () { case $WLERR in - 0) echo yes; exit 0;; - 127) echo "no ($AL)"; exit 1;; - *) echo "no (wl error: $AL)"; exit 1;; - *) echo "no (no wl executable, or error)"; exit 1;; + 0) echo yes;; + 127) echo "no ($AL)";; + *) echo "no (wl error: $AL)";; esac + exit 0 } case $1 in diff --git a/plugins/php/php_apc_ b/plugins/php/php_apc_ index 82c00177..bbf152e3 100755 --- a/plugins/php/php_apc_ +++ b/plugins/php/php_apc_ @@ -39,8 +39,12 @@ WGET_FLAGS="-Yoff"; # refer to wget manual, you may set extra parameters like di act=`basename $0 | sed 's/^php_apc_//g'` if [ "$1" = "autoconf" ]; then - [ -z "$URL" ] && echo "no (edit URL config in header file !)" && exit 1 - [ -n "$URL" ] && echo "yes" && exit 0 + if [ -z "$URL" ]; then + echo "no (missing URL config in header file)" + else + echo "yes" + fi + exit 0 fi if [ "$1" = "suggest" ]; then diff --git a/plugins/php/php_opcache b/plugins/php/php_opcache index 4055d72f..89d18b4a 100755 --- a/plugins/php/php_opcache +++ b/plugins/php/php_opcache @@ -21,8 +21,12 @@ WGET_FLAGS="-Yoff"; # refer to wget manual, you may set extra parameters like di act=memory if [ "$1" = "autoconf" ]; then - [ -z "$URL" ] && echo "no (edit URL config in header file !)" && exit 1 - [ -n "$URL" ] && echo "yes" && exit 0 + if [ -z "$URL" ]; then + echo "no (missing URL config in header file)" + else + echo "yes" + fi + exit 0 fi if [ "$1" = "suggest" ]; then diff --git a/plugins/wifi/wifi_signal b/plugins/wifi/wifi_signal index a1e24306..0126320f 100755 --- a/plugins/wifi/wifi_signal +++ b/plugins/wifi/wifi_signal @@ -32,23 +32,16 @@ do_config () { } do_autoconf () { - if [ ! -f $PNWL ] ; then - echo "no (no $PNWL)" - exit 1 + if [ ! -f "$PNWL" ]; then + echo "no (missing file '$PNWL')" + elif [ ! -r "$PNWL" ]; then + echo "no (cannot read file '$PNWL')" + elif grep -qs : "$PNWL"; then + echo yes + else + echo "no (no devices in $PNWL)" fi - - if [ ! -r $PNWL ] ; then - echo "no (could not read $PNWL)" - exit 1 - fi - - if grep -qs : $PNWL ; then - echo yes - exit 0 - fi - - echo "no (no devices in $PNWL)" - exit 1 + exit 0 } case $1 in diff --git a/plugins/zfs/zfs_cache_efficiency b/plugins/zfs/zfs_cache_efficiency index 0ed85949..c65c7f77 100755 --- a/plugins/zfs/zfs_cache_efficiency +++ b/plugins/zfs/zfs_cache_efficiency @@ -216,22 +216,18 @@ EOF autoconf) if [ ! -x ${sysctl} ]; then echo "no (${sysctl} is not executable)" - exit 1 - fi - if [ ${ostype} = "FreeBSD" ]; then + elif [ "${ostype}" = "FreeBSD" ]; then echo "yes" - exit 0 - fi - if [ ${ostype} = "Linux" ]; then + elif [ "${ostype}" = "Linux" ]; then if [ -f ${procfile} ]; then echo "yes" - exit 0 + else + echo "no (The statsfile does not exist: ${procfile})" fi - echo "no (The statsfile does not exist: ${procfile})" - exit 1 + else + echo "no (Your OS is not supported by this plugin)" fi - echo "no (You're OS is not supported by this plugin)" - exit 1 + exit 0 ;; suggest) exit 0