2
0
mirror of https://github.com/munin-monitoring/contrib.git synced 2018-11-08 00:59:34 +01:00

Improve incorrect or unspecific output for "autoconf"

Some plugins emit wrongly formatted "no" messages or lack the "yes"
message on success.
This commit is contained in:
Lars Kruse 2018-09-16 04:09:21 +02:00
parent e4cd049b01
commit 2ec4e4c1f7
20 changed files with 68 additions and 99 deletions

View File

@ -28,17 +28,16 @@
if [ "$1" = "autoconf" ]; then if [ "$1" = "autoconf" ]; then
if [ -z "$(which amule)" ]; then if [ -z "$(which amule)" ]; then
echo "$0: error: amule not installed" echo "no (amule not installed)"
exit 1
else else
if [ ! -e /tmp/amulesig.dat ]; then if [ ! -e /tmp/amulesig.dat ]; then
echo "$0: error: amulesig.dat not found" echo "no (amulesig.dat not found)"
else else
echo yes echo yes
fi
fi
exit 0 exit 0
fi fi
fi
fi
if [ "$1" = "config" ]; then if [ "$1" = "config" ]; then

View File

@ -28,17 +28,16 @@
if [ "$1" = "autoconf" ]; then if [ "$1" = "autoconf" ]; then
if [ -z "$(which amule)" ]; then if [ -z "$(which amule)" ]; then
echo "$0: error: amule not installed" echo "no (amule not installed)"
exit 1
else else
if [ ! -e /tmp/amulesig.dat ]; then if [ ! -e /tmp/amulesig.dat ]; then
echo "$0: error: amulesig.dat not found" echo "no (amulesig.dat not found)"
else else
echo yes echo yes
fi
fi
exit 0 exit 0
fi fi
fi
fi
if [ "$1" = "config" ]; then if [ "$1" = "config" ]; then

View File

@ -28,17 +28,16 @@
if [ "$1" = "autoconf" ]; then if [ "$1" = "autoconf" ]; then
if [ -z "$(which amule)" ]; then if [ -z "$(which amule)" ]; then
echo "$0: error: amule not installed" echo "no (amule not installed)"
exit 1
else else
if [ ! -e /tmp/amulesig.dat ]; then if [ ! -e /tmp/amulesig.dat ]; then
echo "$0: error: amulesig.dat not found" echo "no (amulesig.dat not found)"
else else
echo yes echo yes
fi
fi
exit 0 exit 0
fi fi
fi
fi
if [ "$1" = "config" ]; then if [ "$1" = "config" ]; then

View File

@ -28,17 +28,16 @@
if [ "$1" = "autoconf" ]; then if [ "$1" = "autoconf" ]; then
if [ -z "$(which amule)" ]; then if [ -z "$(which amule)" ]; then
echo "$0: error: amule not installed" echo "no (amule not installed)"
exit 1
else else
if [ ! -e /tmp/amulesig.dat ]; then if [ ! -e /tmp/amulesig.dat ]; then
echo "$0: error: amulesig.dat not found" echo "no (amulesig.dat not found)"
else else
echo yes echo yes
fi
fi
exit 0 exit 0
fi fi
fi
fi
if [ "$1" = "config" ]; then if [ "$1" = "config" ]; then

View File

@ -122,12 +122,12 @@ if ( defined($ARGV[0]) && $ARGV[0] eq "config" ) {
if ( defined($ARGV[0]) && $ARGV[0] eq "autoconf" ) { if ( defined($ARGV[0]) && $ARGV[0] eq "autoconf" ) {
if (! -f $stat_file) { if (! -f $stat_file) {
printf "Unable to file bind stat file on %s",$stat_file; printf "no (Unable to file bind stat file on %s)",$stat_file;
exit 1; exit 0;
} }
if (! -f $rndc) { if (! -f $rndc) {
printf "Unable to file rndc tool (configured : %s)",$rndc; printf "no (Unable to file rndc tool (configured : %s))",$rndc;
exit 1; exit 0;
} }
exit 0; exit 0;
} }

View File

@ -26,10 +26,10 @@ lvdisplay=$(which lvdisplay)
if [ "$1" = "autoconf" ]; then if [ "$1" = "autoconf" ]; then
if test -n "${lvdisplay}"; then if test -n "${lvdisplay}"; then
echo yes echo yes
exit 0 else
echo "no (lvdisplay not found)"
fi fi
echo "no lvdisplay found" exit 0
exit 1
fi fi

View File

@ -13,11 +13,10 @@
if ($ARGV[0] and $ARGV[0] eq "autoconf") { if ($ARGV[0] and $ARGV[0] eq "autoconf") {
if (-r "/proc/mdstat" and `grep md /proc/mdstat`) { if (-r "/proc/mdstat" and `grep md /proc/mdstat`) {
print "yes\n"; print "yes\n";
exit 0;
} else { } else {
print "no RAID devices\n"; print "no (no RAID devices found)\n";
exit 1;
} }
exit 0;
} }
if ( $ARGV[0] and $ARGV[0] eq "config" ) { if ( $ARGV[0] and $ARGV[0] eq "config" ) {

View File

@ -20,13 +20,12 @@ if ($ARGV[0] and $ARGV[0] eq "autoconf")
if (-r "/proc/fs/xfs/stat") if (-r "/proc/fs/xfs/stat")
{ {
print "yes\n"; print "yes\n";
exit 0;
} }
else else
{ {
print "/proc/fs/xfs/stat not found\n"; print "no (/proc/fs/xfs/stat not found)\n";
exit 1;
} }
exit 0;
} }
my %runtime_stats = ( my %runtime_stats = (

View File

@ -97,30 +97,20 @@ default_timeout=20
default_join_lines=true default_join_lines=true
if [ "${1}" = "autoconf" ]; then if [ "${1}" = "autoconf" ]; then
result=0 if [ -z "$wget_bin" ] || [ ! -f "$wget_bin" ] || [ ! -x "$wget_bin" ]; then
if [ -z "${wget_bin}" -o ! -f "${wget_bin}" -o ! -x "${wget_bin}" ]; then echo "no (missing 'wget' executable)"
result=1 elif [ -z "$time_bin" ] || [ ! -f "$time_bin" ] || [ ! -x "$time_bin" ]; then
echo "no (missing 'time' executable)"
elif [ -z "$mktemp_bin" ] || [ ! -f "$mktemp_bin" ] || [ ! -x "$mktemp_bin" ]; then
echo "no (missing 'mktemp' executable)"
elif [ -z "$grep_bin" ] || [ ! -f "$grep_bin" ] || [ ! -x "$grep_bin" ]; then
echo "no (missing 'grep' executable)"
elif [ -z "$tail_bin" ] || [ ! -f "$tail_bin" ] || [ ! -x "$tail_bin" ]; then
echo "no (missing 'tail' executable)"
else else
if [ -z "${time_bin}" -o ! -f "${time_bin}" -o ! -x "${time_bin}" ]; then
result=2
else
if [ -z "${mktemp_bin}" -o ! -f "${mktemp_bin}" -o ! -x "${mktemp_bin}" ]; then
result=3
else
if [ -z "${grep_bin}" -o ! -f "${grep_bin}" -o ! -x "${grep_bin}" ]; then
result=4
else
[ -z "${tail_bin}" -o ! -f "${tail_bin}" -o ! -x "${tail_bin}" ] && result=5
fi
fi
fi
fi
if [ ${result} -eq 0 ]; then
echo "yes" echo "yes"
else
echo "no"
fi fi
exit $result exit 0
fi fi
if [ -z "${names}" ]; then if [ -z "${names}" ]; then

View File

@ -60,13 +60,12 @@ default_args="--base 1000 -l 0"
default_scale="no" default_scale="no"
if [ "${1}" = "autoconf" ]; then if [ "${1}" = "autoconf" ]; then
result=0
if [ -z "${mysqlbin}" ]; then if [ -z "${mysqlbin}" ]; then
echo "no" echo "no (missing mysql executable)"
else else
echo "yes" echo "yes"
fi fi
exit $result exit 0
fi fi
if [ -z "${names}" ]; then if [ -z "${names}" ]; then

View File

@ -42,12 +42,10 @@ my $Channel="";
if ($ARGV[0] and $ARGV[0] eq "autoconf" ) { if ($ARGV[0] and $ARGV[0] eq "autoconf" ) {
if ( $SQLDBName ne "" ) { if ( $SQLDBName ne "" ) {
print "yes\n"; print "yes\n";
exit 0;
} else { } else {
print "no\n"; print "no (cannot find MythTV configuration file my.txt)\n";
print "cannot find MythTV configuration file my.txt\n";
exit 1;
} }
exit 0;
} }
#Config Options #Config Options

View File

@ -71,7 +71,7 @@ LASTSTREAM=${#STREAMS[*]}
# --- check whether any stream found --- # --- check whether any stream found ---
run_autoconf() { run_autoconf() {
if (( $LASTSTREAM )) ; then echo yes ; exit 0 ; fi # found streams if (( $LASTSTREAM )) ; then echo yes ; exit 0 ; fi # found streams
echo U ; exit 1 ; } # no radio or streams echo no ; exit 0 ; } # no radio or streams

View File

@ -34,9 +34,9 @@ LOGS=${logfile:-/var/log/apache2/error.log}
if [[ $1 == autoconf ]]; then if [[ $1 == autoconf ]]; then
for LOG in $LOGS; do for LOG in $LOGS; do
if [[ ! -r $LOGS ]]; then if [[ ! -r $LOG ]]; then
echo no echo "no (cannot read '$LOG')"
exit 1 exit 0
fi fi
done done

View File

@ -42,11 +42,12 @@ my $type = undef;
if ( defined $ARGV[0] and $ARGV[0] eq "autoconf" ) if ( defined $ARGV[0] and $ARGV[0] eq "autoconf" )
{ {
if ($ret) if ($ret) {
{
print "no ($ret)\n"; print "no ($ret)\n";
exit 1; } else {
print "yes\n";
} }
exit 0;
} }

View File

@ -87,24 +87,14 @@ ATUN=`$SNMPGET $fnVPNSslStatsActiveTunnels | cut -d ":" -f4 | cut -d " " -f2`
autoconf() autoconf()
{ {
if [ $SCPU ]; then if [ -z "$SCPU" ]; then
echo yes, OID $FGTcpu can be readed. echo "no (one or multiple OID can not be read)"
elif [ -z "$SMEM" ]; then
echo "no (one or multiple OID can not be read)"
elif [ -z "$SCNT" ]; then
echo "no (one or multiple OID can not be read)"
else else
echo no, one or multiple OID can not be readed. echo "yes"
exit 1
fi
if [ $SMEM ]; then
echo yes, OID $fnSysMemUsage can be readed.
else
echo no, one or multiple OID can not be readed.
exit 1
fi
if [ $SCNT ]; then
echo yes, OID $fnSysSesCount can be readed.
else
echo no, one or multiple OID can not be read.
exit 1
fi fi
exit 0 exit 0
} }

View File

@ -12,13 +12,12 @@ if [ "$1" = 'autoconf' ]; then
if [ $zones -gt 1 ]; then if [ $zones -gt 1 ]; then
echo yes echo yes
else else
echo yes echo no
fi fi
exit 0
else else
echo no echo no
exit 1
fi fi
exit 0
fi fi
if [ "$1" = 'config' ]; then if [ "$1" = 'config' ]; then

View File

@ -14,13 +14,12 @@ if [ "$1" = 'autoconf' ]; then
if [ $zones -gt 1 ]; then if [ $zones -gt 1 ]; then
echo yes echo yes
else else
echo yes echo no
fi fi
exit 0
else else
echo no echo no
exit 1
fi fi
exit 0
fi fi
if [ "$1" = 'config' ]; then if [ "$1" = 'config' ]; then

View File

@ -47,12 +47,12 @@ my $timeout = 30;
if ( defined $ARGV[0] and $ARGV[0] eq "autoconf" ) if ( defined $ARGV[0] and $ARGV[0] eq "autoconf" )
{ {
if ($ret) if ($ret) {
{
print "no ($ret)\n"; print "no ($ret)\n";
exit 1; } else {
print "yes\n";
} }
exit 0;
} }
if ( defined $ARGV[0] and $ARGV[0] eq "config" ) if ( defined $ARGV[0] and $ARGV[0] eq "config" )

View File

@ -47,12 +47,12 @@ my $timeout = 30;
if ( defined $ARGV[0] and $ARGV[0] eq "autoconf" ) if ( defined $ARGV[0] and $ARGV[0] eq "autoconf" )
{ {
if ($ret) if ($ret) {
{
print "no ($ret)\n"; print "no ($ret)\n";
exit 1; } else {
print "yes\n";
} }
exit 0;
} }
if ( defined $ARGV[0] and $ARGV[0] eq "config" ) if ( defined $ARGV[0] and $ARGV[0] eq "config" )

View File

@ -119,11 +119,10 @@ if [ "$1" = "autoconf" ]; then
get_infos get_infos
if [ -n "$summary" ]; then if [ -n "$summary" ]; then
echo yes echo yes
exit 0
else else
echo "Cannot connect to ESX server $HOST" echo "no (cannot connect to ESX server $HOST)"
exit 1
fi fi
exit 0
fi fi
if [ "$1" = "config" ]; then if [ "$1" = "config" ]; then