mirror of
https://github.com/munin-monitoring/contrib.git
synced 2018-11-08 00:59:34 +01:00
Restructure incomplete or broken "autoconf" implementations
Some plugins with non-zero autoconf exitcodes (it must be zero instead) deserved a bit of code cleanup for improved readability.
This commit is contained in:
parent
46e2de55de
commit
9cef55a3ed
@ -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
|
||||
|
||||
|
@ -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)
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
||||
|
@ -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
|
||||
|
||||
|
@ -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
|
||||
|
||||
|
@ -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}'`
|
||||
|
@ -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
|
||||
}
|
||||
|
||||
|
@ -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"
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user