Skip to content

Commit

Permalink
Improve incorrect or unspecific output for "autoconf"
Browse files Browse the repository at this point in the history
Some plugins emit wrongly formatted "no" messages or lack the "yes"
message on success.
  • Loading branch information
sumpfralle committed Sep 16, 2018
1 parent e4cd049 commit 2ec4e4c
Show file tree
Hide file tree
Showing 20 changed files with 68 additions and 99 deletions.
7 changes: 3 additions & 4 deletions plugins/amule/amule_queue
Original file line number Diff line number Diff line change
Expand Up @@ -28,16 +28,15 @@

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

if [ "$1" = "config" ]; then
Expand Down
7 changes: 3 additions & 4 deletions plugins/amule/amule_shares
Original file line number Diff line number Diff line change
Expand Up @@ -28,16 +28,15 @@

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

if [ "$1" = "config" ]; then
Expand Down
7 changes: 3 additions & 4 deletions plugins/amule/amule_transfers
Original file line number Diff line number Diff line change
Expand Up @@ -28,16 +28,15 @@

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

if [ "$1" = "config" ]; then
Expand Down
7 changes: 3 additions & 4 deletions plugins/amule/amule_uptime
Original file line number Diff line number Diff line change
Expand Up @@ -28,16 +28,15 @@

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

if [ "$1" = "config" ]; then
Expand Down
8 changes: 4 additions & 4 deletions plugins/bind/bind95_
Original file line number Diff line number Diff line change
Expand Up @@ -122,12 +122,12 @@ if ( defined($ARGV[0]) && $ARGV[0] eq "config" ) {

if ( defined($ARGV[0]) && $ARGV[0] eq "autoconf" ) {
if (! -f $stat_file) {
printf "Unable to file bind stat file on %s",$stat_file;
exit 1;
printf "no (Unable to file bind stat file on %s)",$stat_file;
exit 0;
}
if (! -f $rndc) {
printf "Unable to file rndc tool (configured : %s)",$rndc;
exit 1;
printf "no (Unable to file rndc tool (configured : %s))",$rndc;
exit 0;
}
exit 0;
}
Expand Down
6 changes: 3 additions & 3 deletions plugins/disk/lvm_snap_used
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,10 @@ lvdisplay=$(which lvdisplay)
if [ "$1" = "autoconf" ]; then
if test -n "${lvdisplay}"; then
echo yes
exit 0
else
echo "no (lvdisplay not found)"
fi
echo "no lvdisplay found"
exit 1
exit 0
fi


Expand Down
5 changes: 2 additions & 3 deletions plugins/disk/raid
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,10 @@
if ($ARGV[0] and $ARGV[0] eq "autoconf") {
if (-r "/proc/mdstat" and `grep md /proc/mdstat`) {
print "yes\n";
exit 0;
} else {
print "no RAID devices\n";
exit 1;
print "no (no RAID devices found)\n";
}
exit 0;
}

if ( $ARGV[0] and $ARGV[0] eq "config" ) {
Expand Down
5 changes: 2 additions & 3 deletions plugins/disk/xfs
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,12 @@ if ($ARGV[0] and $ARGV[0] eq "autoconf")
if (-r "/proc/fs/xfs/stat")
{
print "yes\n";
exit 0;
}
else
{
print "/proc/fs/xfs/stat not found\n";
exit 1;
print "no (/proc/fs/xfs/stat not found)\n";
}
exit 0;
}

my %runtime_stats = (
Expand Down
32 changes: 11 additions & 21 deletions plugins/http/wget_page
Original file line number Diff line number Diff line change
Expand Up @@ -97,30 +97,20 @@ default_timeout=20
default_join_lines=true

if [ "${1}" = "autoconf" ]; then
result=0
if [ -z "${wget_bin}" -o ! -f "${wget_bin}" -o ! -x "${wget_bin}" ]; then
result=1
if [ -z "$wget_bin" ] || [ ! -f "$wget_bin" ] || [ ! -x "$wget_bin" ]; then
echo "no (missing 'wget' executable)"
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
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"
else
echo "no"
fi
exit $result
exit 0
fi

if [ -z "${names}" ]; then
Expand Down
5 changes: 2 additions & 3 deletions plugins/mysql/mysql_report
Original file line number Diff line number Diff line change
Expand Up @@ -60,13 +60,12 @@ default_args="--base 1000 -l 0"
default_scale="no"

if [ "${1}" = "autoconf" ]; then
result=0
if [ -z "${mysqlbin}" ]; then
echo "no"
echo "no (missing mysql executable)"
else
echo "yes"
fi
exit $result
exit 0
fi

if [ -z "${names}" ]; then
Expand Down
6 changes: 2 additions & 4 deletions plugins/mythtv/mythtv_programs
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,10 @@ my $Channel="";
if ($ARGV[0] and $ARGV[0] eq "autoconf" ) {
if ( $SQLDBName ne "" ) {
print "yes\n";
exit 0;
} else {
print "no\n";
print "cannot find MythTV configuration file my.txt\n";
exit 1;
print "no (cannot find MythTV configuration file my.txt)\n";
}
exit 0;
}

#Config Options
Expand Down
2 changes: 1 addition & 1 deletion plugins/other/listeners
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ LASTSTREAM=${#STREAMS[*]}
# --- check whether any stream found ---
run_autoconf() {
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



Expand Down
6 changes: 3 additions & 3 deletions plugins/php/php_errors_
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,9 @@ LOGS=${logfile:-/var/log/apache2/error.log}

if [[ $1 == autoconf ]]; then
for LOG in $LOGS; do
if [[ ! -r $LOGS ]]; then
echo no
exit 1
if [[ ! -r $LOG ]]; then
echo "no (cannot read '$LOG')"
exit 0
fi
done

Expand Down
7 changes: 4 additions & 3 deletions plugins/punbb/punbb_users
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,12 @@ my $type = undef;

if ( defined $ARGV[0] and $ARGV[0] eq "autoconf" )
{
if ($ret)
{
if ($ret) {
print "no ($ret)\n";
exit 1;
} else {
print "yes\n";
}
exit 0;

}

Expand Down
26 changes: 8 additions & 18 deletions plugins/snmp/snmp__fn
Original file line number Diff line number Diff line change
Expand Up @@ -87,26 +87,16 @@ ATUN=`$SNMPGET $fnVPNSslStatsActiveTunnels | cut -d ":" -f4 | cut -d " " -f2`

autoconf()
{
if [ $SCPU ]; then
echo yes, OID $FGTcpu can be readed.
if [ -z "$SCPU" ]; then
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
echo no, one or multiple OID can not be readed.
exit 1
echo "yes"
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
exit 0
exit 0
}

config()
Expand Down
5 changes: 2 additions & 3 deletions plugins/solaris/zones_cpu
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,12 @@ if [ "$1" = 'autoconf' ]; then
if [ $zones -gt 1 ]; then
echo yes
else
echo yes
echo no
fi
exit 0
else
echo no
exit 1
fi
exit 0
fi

if [ "$1" = 'config' ]; then
Expand Down
5 changes: 2 additions & 3 deletions plugins/solaris/zones_mem
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,12 @@ if [ "$1" = 'autoconf' ]; then
if [ $zones -gt 1 ]; then
echo yes
else
echo yes
echo no
fi
exit 0
else
echo no
exit 1
fi
exit 0
fi

if [ "$1" = 'config' ]; then
Expand Down
8 changes: 4 additions & 4 deletions plugins/vbulletin/vbulletin4_users
Original file line number Diff line number Diff line change
Expand Up @@ -47,12 +47,12 @@ my $timeout = 30;

if ( defined $ARGV[0] and $ARGV[0] eq "autoconf" )
{
if ($ret)
{
if ($ret) {
print "no ($ret)\n";
exit 1;
} else {
print "yes\n";
}

exit 0;
}

if ( defined $ARGV[0] and $ARGV[0] eq "config" )
Expand Down
8 changes: 4 additions & 4 deletions plugins/vbulletin/vbulletin_users
Original file line number Diff line number Diff line change
Expand Up @@ -47,12 +47,12 @@ my $timeout = 30;

if ( defined $ARGV[0] and $ARGV[0] eq "autoconf" )
{
if ($ret)
{
if ($ret) {
print "no ($ret)\n";
exit 1;
} else {
print "yes\n";
}

exit 0;
}

if ( defined $ARGV[0] and $ARGV[0] eq "config" )
Expand Down
5 changes: 2 additions & 3 deletions plugins/vmware/esxi
Original file line number Diff line number Diff line change
Expand Up @@ -119,11 +119,10 @@ if [ "$1" = "autoconf" ]; then
get_infos
if [ -n "$summary" ]; then
echo yes
exit 0
else
echo "Cannot connect to ESX server $HOST"
exit 1
echo "no (cannot connect to ESX server $HOST)"
fi
exit 0
fi

if [ "$1" = "config" ]; then
Expand Down

0 comments on commit 2ec4e4c

Please sign in to comment.