From e4cd049b01376089f1f3d06994c14bb2e9130ae8 Mon Sep 17 00:00:00 2001 From: Lars Kruse Date: Sun, 16 Sep 2018 04:01:57 +0200 Subject: [PATCH 1/4] Fix trivial instances of wrong autoconf exitcodes --- plugins/accounting/accounting_ | 12 +++++------- plugins/amavis/amavis-debian | 3 +-- plugins/amavis/amavis_ | 3 +-- plugins/amavis/amavis_awk | 3 +-- plugins/amr/amr | 3 +-- plugins/apache/apache_activity | 4 ++-- plugins/apache/apache_users | 5 +---- plugins/apache/apache_watch_ | 4 ++-- plugins/asterisk/asterisk_inuse | 4 +--- plugins/battery/acpi-battery | 3 +-- plugins/bigbrother/b3error_ | 3 +-- plugins/bind/bind_ | 4 ++-- plugins/bird/bird | 3 +-- plugins/boinc/boinc_processes | 2 +- plugins/condor/condor_activity_ | 2 +- plugins/condor/condor_ops_ | 2 +- plugins/condor/condor_queue_ | 2 +- plugins/condor/condor_states_ | 2 +- plugins/disk/du | 3 +-- plugins/disk/e2 | 3 +-- plugins/disk/hpasmcli2_ | 4 +--- plugins/disk/linux_diskstat_ | 3 +-- plugins/disk/md_iostat_ | 6 +++--- plugins/disk/megaraid-controller-information | 3 +-- plugins/disk/raid-mismatch-count | 4 +--- plugins/dkim/dkimproxy_mails | 3 +-- plugins/dovecot/dovecot1 | 6 +++--- plugins/fan/ibmfan | 3 +-- plugins/fax/faxstat | 3 +-- plugins/ftp/pure-ftpd-bw | 4 ++-- plugins/ftp/pure-ftpd-logs | 4 ++-- plugins/ftp/vsftpd | 2 +- plugins/ftp/vsftpd-rel | 2 +- plugins/http/mongrel_memory | 2 +- plugins/http/mongrel_process_memory | 2 +- plugins/icecast/icecast2 | 6 +++--- plugins/ip6/ip6_ | 4 +--- plugins/memory/proc_memory_status | 3 +-- plugins/mogilefs/mogilefsd_activity | 4 ++-- plugins/mogilefs/mogilefsd_queries | 4 ++-- plugins/munin/healthcheck_log | 4 ++-- plugins/munin/healthcheck_process | 4 ++-- plugins/munin/healthcheck_url | 4 ++-- plugins/munin/update | 8 ++++---- plugins/mysql/mysql_size_ondisk | 3 +-- plugins/nagios/nagiosstatus | 3 +-- plugins/network/denyhosts | 3 +-- plugins/network/dns/dnsresponse_ | 3 +-- plugins/network/ethtool_ | 3 +-- plugins/network/fms | 3 +-- plugins/network/fms_apps | 3 +-- plugins/network/fms_apps_rate | 3 +-- plugins/network/fwbuilder_ | 4 +--- plugins/network/hostsdeny | 3 +-- plugins/network/if_uptime | 2 -- plugins/network/ip_forward_ | 4 +--- plugins/network/ipfwnat_ | 4 ++-- plugins/network/ipt_accounting_ | 4 +--- plugins/network/ipt_basic_ | 4 +--- plugins/network/ldap_connections | 7 +++---- plugins/network/mtr100_ | 4 +--- plugins/network/proc_netstat | 3 +-- plugins/network/qos_ | 4 ++-- plugins/network/smtp_hello_ | 3 +-- plugins/network/tc_ | 3 +-- plugins/network/tc_drops_ | 3 +-- plugins/network/tc_packets_ | 3 +-- plugins/network/zenus_ | 4 ++-- plugins/nfs/nfsv4 | 3 +-- plugins/nginx/nginx-combined | 4 ++-- plugins/nginx/nginx_connection_request | 4 ++-- plugins/ntp/ntp_peers | 4 +--- plugins/ntp/ntp_peers_ipv6 | 4 +--- plugins/ntp/ntp_queries | 4 +--- plugins/openvz/vpsmem | 3 +-- plugins/oracle/oracle__connections | 4 ++-- plugins/oracle/oracle__database_hitratio | 4 ++-- plugins/oracle/oracle__locks | 4 ++-- plugins/oracle/oracle__tablespace_usage | 4 ++-- plugins/other/earthquakes | 3 +-- plugins/other/opentracker_ | 3 +-- plugins/pf/pf | 10 +++++----- plugins/pf/pf_bytes | 4 ++-- plugins/pf/pf_openbsd | 8 ++++---- plugins/pf/pf_packets | 8 ++++---- plugins/pf/pf_states | 8 ++++---- plugins/php/php_sessions | 3 +-- plugins/php/php_time_execution | 3 +-- plugins/ping/multiping | 3 +-- plugins/ping/pinger | 3 +-- plugins/postfix/postfix-policyd | 3 +-- plugins/postfix/postfix_filtered | 3 +-- plugins/postfix/postfix_filtered_awk | 3 +-- plugins/postfix/postfix_mailfiltered | 3 +-- plugins/postfix/postfix_mailstats | 2 +- plugins/postfix/postfix_mailvolume_multi | 1 - plugins/postfix/postgrey | 3 +-- plugins/postfix/postgrey-new | 3 +-- plugins/postgresql/pgbouncer_ | 3 +-- plugins/postgresql/postgres_block_read_ | 4 ++-- plugins/postgresql/postgres_space_ | 4 ++-- plugins/power/apcupsd_ww | 3 +-- plugins/power/nut | 3 +-- plugins/qmail/qmailsend | 3 +-- plugins/qmail/qmailsend_plesk | 3 +-- plugins/qmail/spamdyke | 3 +-- plugins/radiator/radiator_acct_lag | 3 +-- plugins/radiator/radiator_acct_ppm | 3 +-- plugins/radiator/radiator_auth_lag | 3 +-- plugins/radiator/radiator_auth_ppm | 3 +-- plugins/router/freeboxuptime | 4 +--- plugins/router/tg585v7__ | 4 ++-- plugins/rsync/rsyncd_bytes | 3 +-- plugins/rsync/rsyncd_count | 3 +-- plugins/s3/s3_items | 7 +++---- plugins/s3/s3_storage | 10 +++------- plugins/sar/iostat-cputps-average | 4 +--- plugins/security/forefront_ | 6 +++--- plugins/sensors/mbmon | 3 +-- plugins/sensors/nvclock | 3 +-- plugins/sge/sge_queue_ | 3 +-- plugins/sge/sge_queue_xml_ | 3 +-- plugins/smstools/smstools_ | 3 +-- plugins/snmp/snmp_room_alert_ | 2 +- plugins/solaris/solaris-memstat | 3 +-- plugins/sourceds/srcds_cpu | 6 +++--- plugins/sourceds/srcds_fps | 6 +++--- plugins/sourceds/srcds_inout | 6 +++--- plugins/sourceds/srcds_players | 6 +++--- plugins/sourceds/srcds_uptime | 6 +++--- plugins/squid/squid_times | 3 +-- plugins/ssh/openssh-denyhosts | 3 +-- plugins/ssh/sshd_invalid_countries_ruby | 2 +- plugins/system/blockhosts | 3 +-- plugins/tcp/tcp-states | 4 +--- plugins/thin/thin_memory | 2 +- plugins/thin/thin_threads | 2 +- plugins/thin/thins_peak_memory | 2 +- plugins/tor/tor-bandwidth-usage | 4 ++-- plugins/tor/tor_routers | 4 ++-- plugins/ultramonkey/ultramonkey-l7 | 5 ++--- plugins/uucp/uustat | 3 +-- plugins/vpn/openvpn_multi | 3 +-- plugins/weather/humidity-sensor | 3 +-- plugins/weather/temperature_ | 3 +-- plugins/weather/temperatures | 3 +-- plugins/xbnbt/xbnbt_peers | 4 +--- plugins/xen/xen | 6 +++--- plugins/xen/xen-cpu | 3 +-- plugins/xen/xen_cpu_v2 | 3 +-- plugins/yum/yum_activity | 3 +-- plugins/zfs/zfsarcstats-counters | 8 ++++---- 152 files changed, 225 insertions(+), 344 deletions(-) diff --git a/plugins/accounting/accounting_ b/plugins/accounting/accounting_ index 7628d3a2..526b69f9 100755 --- a/plugins/accounting/accounting_ +++ b/plugins/accounting/accounting_ @@ -116,17 +116,15 @@ fi if [ "$1" == "autoconf" ]; then if [ -r /proc/net/dev ]; then $IPTABLES -L INPUT -v -n -x -w >/dev/null 2>/dev/null - if [ $? -gt 0 ]; then - echo "no (could not run iptables as user `whoami`)" - exit 1 - else - echo yes - exit 0 + if [ $? -gt 0 ]; then + echo "no (could not run iptables as user `whoami`)" + else + echo yes fi else echo "no (/proc/net/dev not found)" - exit 1 fi + exit 0 fi if [ "$1" = "suggest" ]; then diff --git a/plugins/amavis/amavis-debian b/plugins/amavis/amavis-debian index b80e527c..47d3c7b1 100755 --- a/plugins/amavis/amavis-debian +++ b/plugins/amavis/amavis-debian @@ -37,11 +37,10 @@ mktempfile () { if [ "$1" = "autoconf" ]; then if [ -f "${AMAVIS_LOG}" -a -n "${LOGTAIL}" -a -x "${LOGTAIL}" -a -n "${BC}" -a -x "${BC}" ] ; then echo yes - exit 0 else echo no - exit 1 fi + exit 0 fi if [ "$1" = "config" ]; then diff --git a/plugins/amavis/amavis_ b/plugins/amavis/amavis_ index c27d9cb2..2287f4a4 100755 --- a/plugins/amavis/amavis_ +++ b/plugins/amavis/amavis_ @@ -45,11 +45,10 @@ my($db_home) = # DB databases directory if ($ARGV[0] and $ARGV[0] eq "autoconf") { if (-x "/usr/sbin/amavisd-agent") { print "yes\n"; - exit 0; } else { print "no (/usr/sbin/amavisd-agent not found or not executable)\n"; - exit 1; } + exit 0; } elsif ($ARGV[0] and $ARGV[0] eq "suggest") { print "time\n"; print "cache\n"; diff --git a/plugins/amavis/amavis_awk b/plugins/amavis/amavis_awk index 332a2b60..04b6e279 100755 --- a/plugins/amavis/amavis_awk +++ b/plugins/amavis/amavis_awk @@ -23,11 +23,10 @@ STATEFILE=$MUNIN_PLUGSTATE/amavis.offset if [ "$1" = "autoconf" ]; then if [ -f "${MAIL_LOG}" -a -n "${LOGTAIL}" -a -x "${LOGTAIL}" ] ; then echo yes - exit 0 else echo no - exit 1 fi + exit 0 fi if [ "$1" = "config" ]; then diff --git a/plugins/amr/amr b/plugins/amr/amr index 75b981b4..e6ae91e9 100755 --- a/plugins/amr/amr +++ b/plugins/amr/amr @@ -54,14 +54,13 @@ sub autoconf if (-d $LOGDIR) { if (-f $logfile) { print "yes\n"; - exit 0; } else { print "no (logfile not found)\n"; } } else { print "no (could not find logdir)\n"; } - exit 1; + exit 0; } sub config diff --git a/plugins/apache/apache_activity b/plugins/apache/apache_activity index 777125fb..a1dfc3fa 100755 --- a/plugins/apache/apache_activity +++ b/plugins/apache/apache_activity @@ -42,7 +42,7 @@ my %chars = ( if (exists $ARGV[0] and $ARGV[0] eq "autoconf") { if ($ret) { print "no ($ret)\n"; - exit 1; + exit 0; } my $ua = LWP::UserAgent->new(timeout => 30); my @badports; @@ -55,7 +55,7 @@ if (exists $ARGV[0] and $ARGV[0] eq "autoconf") { if (@badports) { print "no (no apache server-status on ports @badports)\n"; - exit 1; + exit 0; } else { print "yes\n"; exit 0; diff --git a/plugins/apache/apache_users b/plugins/apache/apache_users index bc178f41..257e8fa1 100755 --- a/plugins/apache/apache_users +++ b/plugins/apache/apache_users @@ -23,16 +23,13 @@ then if ! ls $ACCESSLOG > /dev/null then echo "no (could not find apache access log \"$ACCESSLOG\")" - exit 1 elif ! ls $DIRECTORY > /dev/null then echo "no (could not find munin plugins directory \"$DIRECTORY\")" - exit 2 - else echo "yes" - exit 0 fi + exit 0 fi # ######################################################################################### INIT diff --git a/plugins/apache/apache_watch_ b/plugins/apache/apache_watch_ index 88c2fd3d..ae74ca55 100755 --- a/plugins/apache/apache_watch_ +++ b/plugins/apache/apache_watch_ @@ -39,7 +39,7 @@ my $type = "throughput"; if (exists $ARGV[0] and $ARGV[0] eq "autoconf") { if ($ret) { print "no ($ret)\n"; - exit 1; + exit 0; } my $ua = LWP::UserAgent->new (timeout => 30); my @badports; @@ -52,7 +52,7 @@ if (exists $ARGV[0] and $ARGV[0] eq "autoconf") { if (@badports) { print "no (no mod_watch exists on ports @badports)\n"; - exit 1; + exit 0; } else { print "yes\n"; exit 0; diff --git a/plugins/asterisk/asterisk_inuse b/plugins/asterisk/asterisk_inuse index 837890e1..aaacbb20 100755 --- a/plugins/asterisk/asterisk_inuse +++ b/plugins/asterisk/asterisk_inuse @@ -11,15 +11,13 @@ if [ "$1" = "autoconf" ]; then asterisk -rx 'sip show inuse' > /dev/null if [ $? = "0" ]; then echo yes - exit 0 else echo no - exit 1 fi else echo no - exit 1 fi + exit 0 fi if [ "$1" = "config" ]; then diff --git a/plugins/battery/acpi-battery b/plugins/battery/acpi-battery index 147ee3fd..4ea36752 100755 --- a/plugins/battery/acpi-battery +++ b/plugins/battery/acpi-battery @@ -32,11 +32,10 @@ if [ "$1" = "autoconf" ]; then if grep -q 'present.*yes' /proc/acpi/battery/*/info > /dev/null 2>&1; then echo yes - exit 0 else echo "no (battery not detected)" - exit 1 fi + exit 0 fi cd /proc/acpi/battery diff --git a/plugins/bigbrother/b3error_ b/plugins/bigbrother/b3error_ index 853bb544..23b5dab1 100755 --- a/plugins/bigbrother/b3error_ +++ b/plugins/bigbrother/b3error_ @@ -29,7 +29,6 @@ mktempfile () { if [ "$1" = "autoconf" ]; then if [ -n "${B3NAME}" -a -f "${logfile}" -a -n "${LOGTAIL}" -a -x "${LOGTAIL}" ]; then echo yes - exit 0 else echo -n "no" if [ ! -n "${B3NAME}" ]; then @@ -43,8 +42,8 @@ if [ "$1" = "autoconf" ]; then elif [ ! -x "${LOGTAIL}" ]; then echo " (cannot execute ${LOGTAIL})" fi - exit 1 fi + exit 0 fi if [ "$1" = "config" ]; then diff --git a/plugins/bind/bind_ b/plugins/bind/bind_ index 92fd8759..6f7f5098 100755 --- a/plugins/bind/bind_ +++ b/plugins/bind/bind_ @@ -98,11 +98,11 @@ 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; + exit 0; } if (! -f $rndc) { printf "Unable to file rndc tool (configured : %s)",$rndc; - exit 1; + exit 0; } exit 0; } diff --git a/plugins/bird/bird b/plugins/bird/bird index b9c37926..b6aa4e15 100755 --- a/plugins/bird/bird +++ b/plugins/bird/bird @@ -111,11 +111,10 @@ sub get_stats { sub autoconf { if (-S $socket) { say 'yes'; - exit 0; } else { say 'no'; - exit 1; } + exit 0; } sub config { diff --git a/plugins/boinc/boinc_processes b/plugins/boinc/boinc_processes index d0e05f74..0d06d1b7 100755 --- a/plugins/boinc/boinc_processes +++ b/plugins/boinc/boinc_processes @@ -63,7 +63,7 @@ sub autoconf { } } print "no\n"; - exit 1; + exit 0; } sub config { diff --git a/plugins/condor/condor_activity_ b/plugins/condor/condor_activity_ index adc6a579..0f05bc49 100755 --- a/plugins/condor/condor_activity_ +++ b/plugins/condor/condor_activity_ @@ -52,7 +52,7 @@ fi if [ "$1" = "autoconf" ]; then echo "no" - exit 1 + exit 0 fi if [ "$1" = "suggest" ]; then diff --git a/plugins/condor/condor_ops_ b/plugins/condor/condor_ops_ index 7321c4c5..3af67087 100755 --- a/plugins/condor/condor_ops_ +++ b/plugins/condor/condor_ops_ @@ -53,7 +53,7 @@ fi if [ "$1" = "autoconf" ]; then echo "no" - exit 1 + exit 0 fi if [ "$1" = "suggest" ]; then diff --git a/plugins/condor/condor_queue_ b/plugins/condor/condor_queue_ index 952953e1..53717bed 100755 --- a/plugins/condor/condor_queue_ +++ b/plugins/condor/condor_queue_ @@ -55,7 +55,7 @@ fi if [ "$1" = "autoconf" ]; then echo "no" - exit 1 + exit 0 fi if [ "$1" = "suggest" ]; then diff --git a/plugins/condor/condor_states_ b/plugins/condor/condor_states_ index faebdaee..98392dff 100755 --- a/plugins/condor/condor_states_ +++ b/plugins/condor/condor_states_ @@ -52,7 +52,7 @@ fi if [ "$1" = "autoconf" ]; then echo "no" - exit 1 + exit 0 fi if [ "$1" = "suggest" ]; then diff --git a/plugins/disk/du b/plugins/disk/du index 4f125077..0d886146 100755 --- a/plugins/disk/du +++ b/plugins/disk/du @@ -58,11 +58,10 @@ ID=1; if [ "$1" = "autoconf" ]; then if [ -d $DIR ]; then echo "yes" - exit 0 else echo "no (check your path)" - exit 1 fi + exit 0 fi if [ "$1" = "config" ]; then diff --git a/plugins/disk/e2 b/plugins/disk/e2 index ea6a0d3c..a9080055 100755 --- a/plugins/disk/e2 +++ b/plugins/disk/e2 @@ -57,11 +57,10 @@ lse2() { if [ "$1" = "autoconf" ]; then if which dumpe2fs >/dev/null 2>&1; then echo yes - exit 0 else echo no - exit 1 fi + exit 0 fi if [ "$1" = "suggest" ]; then lse2 | while read name rest; do diff --git a/plugins/disk/hpasmcli2_ b/plugins/disk/hpasmcli2_ index 069caffe..f0d6bb0d 100755 --- a/plugins/disk/hpasmcli2_ +++ b/plugins/disk/hpasmcli2_ @@ -60,7 +60,6 @@ if (defined($ARGV[0])) { my @chk_result = `$hpasmcli -s \"help\"`; if ($? eq "0") { print "yes\n"; - exit 0; } else { my $reason = 'Unknown error'; foreach my $line (@chk_result) { @@ -71,12 +70,11 @@ if (defined($ARGV[0])) { } } print "no ($reason)\n"; - exit 1; } } else { print "no (hpasmcli not found)\n"; - exit 1; } + exit 0; } elsif ($ARGV[0] eq 'suggest') { print "temp\nfans\n"; exit 0; diff --git a/plugins/disk/linux_diskstat_ b/plugins/disk/linux_diskstat_ index 6628307b..9a6131b3 100755 --- a/plugins/disk/linux_diskstat_ +++ b/plugins/disk/linux_diskstat_ @@ -147,12 +147,11 @@ if ( defined $ARGV[0] && $ARGV[0] eq 'autoconf' ) { if ( !$@ && keys %stats ) { print "yes\n"; - exit 0; } else { print "no\n"; - exit 1; } + exit 0; } diff --git a/plugins/disk/md_iostat_ b/plugins/disk/md_iostat_ index 33d5a472..cc7f8928 100755 --- a/plugins/disk/md_iostat_ +++ b/plugins/disk/md_iostat_ @@ -96,10 +96,10 @@ $mdstat_present = -f '/proc/mdstat'; if ( defined($ARGV[0]) and $ARGV[0] eq "autoconf") { if ($mdstat_present and ($detailed_present or $stat_present)) { print "yes\n"; - exit 0; + } else { + print "no\n"; } - print "no\n"; - exit 1; + exit 0; } my %devs; diff --git a/plugins/disk/megaraid-controller-information b/plugins/disk/megaraid-controller-information index 6b18b4d5..7737fa6e 100755 --- a/plugins/disk/megaraid-controller-information +++ b/plugins/disk/megaraid-controller-information @@ -126,11 +126,10 @@ my %config = ( if ($ARGV[0] and $ARGV[0] eq "autoconf" ) { if (-e $Command ) { print "yes\n"; - exit 0; } else { print "no\n"; - exit 1 } + exit 0; } #Read Output of MegaRaid command diff --git a/plugins/disk/raid-mismatch-count b/plugins/disk/raid-mismatch-count index 5979b53f..d51c8901 100755 --- a/plugins/disk/raid-mismatch-count +++ b/plugins/disk/raid-mismatch-count @@ -30,14 +30,12 @@ returnval=$? if [ "x$1" = "xautoconf" ]; then if [ -z "$targets" ]; then echo "no (no md devices found under /sys/devices/virtual/block/*/md/mismatch_cnt)" - exit 1; elif [ "x$returnval" != "x0" ]; then echo "no (discovery of md devices failed strangely)" - exit 1; else echo "yes" - exit 0 fi + exit 0 fi if [ "x$1" = "xconfig" ]; then diff --git a/plugins/dkim/dkimproxy_mails b/plugins/dkim/dkimproxy_mails index b68e4890..ef40dfd5 100755 --- a/plugins/dkim/dkimproxy_mails +++ b/plugins/dkim/dkimproxy_mails @@ -37,11 +37,10 @@ STATEFILE=$MUNIN_PLUGSTATE/dkimproxy_mails.offset if [ "$1" = "autoconf" ]; then if [ -f "${MAIL_LOG}" -a -n "${LOGTAIL}" -a -x "${LOGTAIL}" ] ; then echo yes - exit 0 else echo no - exit 1 fi + exit 0 fi if [ "$1" = "config" ]; then diff --git a/plugins/dovecot/dovecot1 b/plugins/dovecot/dovecot1 index af73b414..62dee459 100755 --- a/plugins/dovecot/dovecot1 +++ b/plugins/dovecot/dovecot1 @@ -36,12 +36,12 @@ if ( $ARGV[0] and $ARGV[0] eq "autoconf" ) { if (! -x $DOVEADM) { print "no (no doveadm)\n"; - exit(1); + exit(0); } if (! -f $logfile) { print "no (logfile $logfile does not exist)\n"; - exit(1); + exit(0); } if (-r "$logfile") { @@ -50,7 +50,7 @@ if ( $ARGV[0] and $ARGV[0] eq "autoconf" ) { } else { print "no (logfile not readable)\n"; } - exit 1; + exit 0; } if (-f "$logfile.0") { diff --git a/plugins/fan/ibmfan b/plugins/fan/ibmfan index bba537b5..cdc338e0 100755 --- a/plugins/fan/ibmfan +++ b/plugins/fan/ibmfan @@ -19,11 +19,10 @@ if [ "$1" = "autoconf" ]; then if [ -r /proc/acpi/ibm/fan ]; then echo yes - exit 0 else echo no - exit 1 fi + exit 0 fi diff --git a/plugins/fax/faxstat b/plugins/fax/faxstat index 75f99366..61962dec 100755 --- a/plugins/fax/faxstat +++ b/plugins/fax/faxstat @@ -20,11 +20,10 @@ FAXQ=${faxq:=/usr/sbin/faxqclean} if [ "$1" = "autoconf" ]; then if [ -x ${FAXSTAT} ] ; then echo yes - exit 0 else echo no - exit 1 fi + exit 0 fi JOBTYPES="Running Waiting Done" diff --git a/plugins/ftp/pure-ftpd-bw b/plugins/ftp/pure-ftpd-bw index 10ef8e73..c0c18110 100755 --- a/plugins/ftp/pure-ftpd-bw +++ b/plugins/ftp/pure-ftpd-bw @@ -42,11 +42,11 @@ if [ "$1" = "autoconf" ]; then exit 0 else echo "no (logtail not found)" - exit 1 + exit 0 fi else echo "no (logfile $LOGFILE does not exist)" - exit 1 + exit 0 fi fi diff --git a/plugins/ftp/pure-ftpd-logs b/plugins/ftp/pure-ftpd-logs index 2a0add13..1ebc8668 100755 --- a/plugins/ftp/pure-ftpd-logs +++ b/plugins/ftp/pure-ftpd-logs @@ -32,11 +32,11 @@ if [ "$1" = "autoconf" ]; then exit 0 else echo "no (logtail not found)" - exit 1 + exit 0 fi else echo "no (logfile ${LOGFILE} does not exist)" - exit 1 + exit 0 fi fi diff --git a/plugins/ftp/vsftpd b/plugins/ftp/vsftpd index d329552f..583d3d0f 100755 --- a/plugins/ftp/vsftpd +++ b/plugins/ftp/vsftpd @@ -8,7 +8,7 @@ if [ "$1" = "autoconf" ]; then exit 0 else echo no - exit 1 + exit 0 fi fi diff --git a/plugins/ftp/vsftpd-rel b/plugins/ftp/vsftpd-rel index 25ee99de..27b4dc96 100755 --- a/plugins/ftp/vsftpd-rel +++ b/plugins/ftp/vsftpd-rel @@ -56,7 +56,7 @@ then exit 0 else echo no - exit 1 + exit 0 fi fi diff --git a/plugins/http/mongrel_memory b/plugins/http/mongrel_memory index 8448d5cd..aa107675 100755 --- a/plugins/http/mongrel_memory +++ b/plugins/http/mongrel_memory @@ -83,7 +83,7 @@ when "autoconf" exit 0 end puts "no" - exit 1 + exit 0 else mpm.run end diff --git a/plugins/http/mongrel_process_memory b/plugins/http/mongrel_process_memory index 0febcfe0..958679ea 100755 --- a/plugins/http/mongrel_process_memory +++ b/plugins/http/mongrel_process_memory @@ -94,7 +94,7 @@ when "autoconf" exit 0 end puts "no" - exit 1 + exit 0 else mpm.run end diff --git a/plugins/icecast/icecast2 b/plugins/icecast/icecast2 index 2287302d..de3742aa 100755 --- a/plugins/icecast/icecast2 +++ b/plugins/icecast/icecast2 @@ -26,11 +26,11 @@ case $1 in autoconf|detect) if [ -d $ICEDIR/ ] ; then echo yes - exit 0 else echo "no (icedir not found)" - exit 1 - fi;; + fi + exit 0 + ;; config) cat <<'EOF' graph_title Icecast2 Stream Listeners diff --git a/plugins/ip6/ip6_ b/plugins/ip6/ip6_ index 54a5f1e3..5c7114ff 100755 --- a/plugins/ip6/ip6_ +++ b/plugins/ip6/ip6_ @@ -31,15 +31,13 @@ if [ "$1" = "autoconf" ]; then ip6tables -L INPUT -v -n -x -w >/dev/null 2>/dev/null if [ $? -gt 0 ]; then echo "no (could not run ip6tables as user `whoami`)" - exit 1 else echo yes - exit 0 fi else echo "no (/proc/net/dev not found)" - exit 1 fi + exit 0 fi if [ "$1" = "suggest" ]; then diff --git a/plugins/memory/proc_memory_status b/plugins/memory/proc_memory_status index e5e1aa65..6f2f07fc 100755 --- a/plugins/memory/proc_memory_status +++ b/plugins/memory/proc_memory_status @@ -14,11 +14,10 @@ pid=`pgrep -o -x "$process"` if [ "$1" = "autoconf" ]; then if [ -r /proc/$pid/status ]; then echo yes - exit 0 else echo no - exit 1 fi + exit 0 fi if [ "$1" = "config" ]; then diff --git a/plugins/mogilefs/mogilefsd_activity b/plugins/mogilefs/mogilefsd_activity index 11333d16..5a0cf760 100755 --- a/plugins/mogilefs/mogilefsd_activity +++ b/plugins/mogilefs/mogilefsd_activity @@ -61,7 +61,7 @@ sub autoconf { if ($ret) { print "no ($ret)\n"; - exit 1; + exit 0; } my $conn = IO::Socket::INET->new(PeerAddr => $host, @@ -72,7 +72,7 @@ sub autoconf { if (!$conn) { print "no (could not connect: $!)\n"; - exit 1; + exit 0; } my $request = "!stats\n"; diff --git a/plugins/mogilefs/mogilefsd_queries b/plugins/mogilefs/mogilefsd_queries index 5d788f1e..16a79dd5 100755 --- a/plugins/mogilefs/mogilefsd_queries +++ b/plugins/mogilefs/mogilefsd_queries @@ -61,7 +61,7 @@ sub autoconf { if ($ret) { print "no ($ret)\n"; - exit 1; + exit 0; } my $conn = IO::Socket::INET->new(PeerAddr => $host, @@ -72,7 +72,7 @@ sub autoconf { if (!$conn) { print "no (could not connect: $!)\n"; - exit 1; + exit 0; } my $request = "!stats\n"; diff --git a/plugins/munin/healthcheck_log b/plugins/munin/healthcheck_log index 1d36c384..a47f5f4f 100755 --- a/plugins/munin/healthcheck_log +++ b/plugins/munin/healthcheck_log @@ -78,9 +78,9 @@ MINUTE_BY_GREP_RANGE=10 if [ "$1" = "autoconf" ]; then if [ $CHECKMAX -le 1 ]; then echo no - exit 1 + else + echo yes fi - echo yes exit 0 fi diff --git a/plugins/munin/healthcheck_process b/plugins/munin/healthcheck_process index 2eaf40ec..5c3a160d 100755 --- a/plugins/munin/healthcheck_process +++ b/plugins/munin/healthcheck_process @@ -40,9 +40,9 @@ let CHECKMAX="$CHECKMAX + 1" if [ "$1" = "autoconf" ]; then if [ $CHECKMAX -le 1 ]; then echo no - exit 1 + else + echo yes fi - echo yes exit 0 fi diff --git a/plugins/munin/healthcheck_url b/plugins/munin/healthcheck_url index 66d38700..e7faedf3 100755 --- a/plugins/munin/healthcheck_url +++ b/plugins/munin/healthcheck_url @@ -90,9 +90,9 @@ CURL=/usr/bin/curl if [ "$1" = "autoconf" ]; then if [ $CHECKMAX -le 1 ]; then echo no - exit 1 + else + echo yes fi - echo yes exit 0 fi diff --git a/plugins/munin/update b/plugins/munin/update index c86bce9c..e59ae59f 100755 --- a/plugins/munin/update +++ b/plugins/munin/update @@ -40,11 +40,11 @@ fi if [ "$1" = "autoconf" ]; then if [ -f $UPDATE_STATSFILE ]; then - echo "yes" - exit 0 + echo "yes" + else + echo "no (logfile not readable)" fi - echo "no (logfile not readable)" - exit 1 + exit 0 fi if [ "$1" = "config" ]; then diff --git a/plugins/mysql/mysql_size_ondisk b/plugins/mysql/mysql_size_ondisk index 1045b04a..432a7114 100755 --- a/plugins/mysql/mysql_size_ondisk +++ b/plugins/mysql/mysql_size_ondisk @@ -42,11 +42,10 @@ then if du -sb $DIR &> /dev/null then echo "yes" - exit 0 else echo "no" - exit 1 fi + exit 0 elif [ "${1:-}" = "config" ] then echo "graph_title MySQL on-disk database size" diff --git a/plugins/nagios/nagiosstatus b/plugins/nagios/nagiosstatus index 051a1fcd..aa5fc49e 100755 --- a/plugins/nagios/nagiosstatus +++ b/plugins/nagios/nagiosstatus @@ -46,11 +46,10 @@ if ($ARGV[0]) { if ($ARGV[0] eq 'autoconf') { if (-r $NAGIOSSTAT) { print "yes"; - exit 0; } else { print "no (Nagios status file not found)"; - exit 1; } + exit 0; } elsif ($ARGV[0] eq "config") { print "graph_args --base 1000 -l 0 --vertical-label Checks\n"; print "graph_title Nagios status\n"; diff --git a/plugins/network/denyhosts b/plugins/network/denyhosts index 8617caed..8eda6f17 100755 --- a/plugins/network/denyhosts +++ b/plugins/network/denyhosts @@ -19,11 +19,10 @@ LOG=/etc/hosts.deny if [ "$1" = "autoconf" ]; then if [ -r "$LOG" ]; then echo yes - exit 0 else echo no - exit 1 fi + exit 0 fi if [ "$1" = "config" ]; then diff --git a/plugins/network/dns/dnsresponse_ b/plugins/network/dns/dnsresponse_ index 684d92bd..b3821f57 100755 --- a/plugins/network/dns/dnsresponse_ +++ b/plugins/network/dns/dnsresponse_ @@ -93,11 +93,10 @@ if ( defined $ARGV[0] and $ARGV[0] eq "autoconf" ) { if (! -s $resconf) { $ret .= "$resconf not found. "; } if ($ret) { print "no ($ret)\n"; - exit 1; } else { print "yes\n"; - exit 0; } + exit 0; } if ( defined $ARGV[0] and $ARGV[0] eq "suggest" ) { diff --git a/plugins/network/ethtool_ b/plugins/network/ethtool_ index be9ea456..8d477e73 100755 --- a/plugins/network/ethtool_ +++ b/plugins/network/ethtool_ @@ -42,11 +42,10 @@ if [ "$1" = "autoconf" ]; then $ETHTOOL 2>/dev/null >/dev/null if [ $? -ne 0 ]; then echo no - exit 1 else echo yes - exit 0 fi + exit 0 fi if [ "$1" = "config" ]; then diff --git a/plugins/network/fms b/plugins/network/fms index 2aaf70ee..c1502ebd 100755 --- a/plugins/network/fms +++ b/plugins/network/fms @@ -272,11 +272,10 @@ if ( !( ( $usenetstat eq "yes" and defined($fmshost) and defined($fmsport) ) or if ( defined($ARGV[0]) and $ARGV[0] eq "autoconf" ) { if ( ( $usenetstat eq "yes" and defined($fmshost) and defined($fmsport) ) or ( $usenetstat eq "no" and defined($adminhost) and defined($adminport) and defined($adminusername) and defined($adminpassword) ) ) { print("yes\n"); - exit 0; } else { print("no\n"); - exit 1; } + exit 0; } if ( $usenetstat eq "yes" and defined($fmshost) and defined($fmsport) ) { diff --git a/plugins/network/fms_apps b/plugins/network/fms_apps index 241958a4..d0bd5cd9 100755 --- a/plugins/network/fms_apps +++ b/plugins/network/fms_apps @@ -200,11 +200,10 @@ if ( defined($ARGV[0]) ) { if ( $ARGV[0] eq "autoconf" ) { if ( defined($host) and defined($port) and defined($username) and defined($password) ) { print("yes\n"); - exit 0; } else { print("no\n"); - exit 1; } + exit 0; } elsif ( $ARGV[0] eq "config" ) { print <<'END_GRAPH_CONFIG'; graph_title Flash Media Server application connections diff --git a/plugins/network/fms_apps_rate b/plugins/network/fms_apps_rate index d84fec3b..41470e05 100755 --- a/plugins/network/fms_apps_rate +++ b/plugins/network/fms_apps_rate @@ -201,11 +201,10 @@ if ( defined($ARGV[0]) ) { if ( $ARGV[0] eq "autoconf" ) { if ( defined($host) and defined($port) and defined($username) and defined($password) ) { print("yes\n"); - exit 0; } else { print("no\n"); - exit 1; } + exit 0; } elsif ( $ARGV[0] eq "config" ) { print <<'END_GRAPH_CONFIG'; graph_title Flash Media Server application connection rates diff --git a/plugins/network/fwbuilder_ b/plugins/network/fwbuilder_ index d8ccfb4a..106f8d42 100755 --- a/plugins/network/fwbuilder_ +++ b/plugins/network/fwbuilder_ @@ -64,15 +64,13 @@ if [ "$1" = "autoconf" ]; then iptables -L INPUT -v -n -x -w >/dev/null 2>/dev/null if [ $? -gt 0 ]; then echo "no (could not run iptables as user `whoami`)" - exit 1 else echo yes - exit 0 fi else echo "no (/proc/net/dev not found)" - exit 1 fi + exit 0 fi if [ "$1" = "suggest" ]; then diff --git a/plugins/network/hostsdeny b/plugins/network/hostsdeny index 3977be38..2d4e7af3 100755 --- a/plugins/network/hostsdeny +++ b/plugins/network/hostsdeny @@ -24,11 +24,10 @@ if [ "$1" = "autoconf" ]; then if [ -r "$LOG" ]; then echo yes - exit 0 else echo no - exit 1 fi + exit 0 fi if [ "$1" = "config" ]; then diff --git a/plugins/network/if_uptime b/plugins/network/if_uptime index 4dce3e7d..9d42565d 100755 --- a/plugins/network/if_uptime +++ b/plugins/network/if_uptime @@ -122,10 +122,8 @@ EOF autoconf) if [[ $(ifconfig &> /dev/null; echo "$?") == 0 ]]; then echo yes - exit 0 else echo "no (ifconfig doesn't work out)" - exit 1 fi exit 0 ;; diff --git a/plugins/network/ip_forward_ b/plugins/network/ip_forward_ index 374092f2..b13cf960 100755 --- a/plugins/network/ip_forward_ +++ b/plugins/network/ip_forward_ @@ -30,15 +30,13 @@ if [ "$1" = "autoconf" ]; then iptables-save -c >/dev/null 2>/dev/null if [ $? -gt 0 ]; then echo "no (could not run iptables-save as user `whoami`)" - exit 1 else echo yes - exit 0 fi else echo "no (/proc/net/dev not found)" - exit 1 fi + exit 0 fi if [ "$1" = "suggest" ]; then diff --git a/plugins/network/ipfwnat_ b/plugins/network/ipfwnat_ index 1ebba2de..79056c9d 100755 --- a/plugins/network/ipfwnat_ +++ b/plugins/network/ipfwnat_ @@ -34,13 +34,13 @@ ipfw="/sbin/ipfw" if [ "$1" = "autoconf" ]; then if [ ! -x $ipfw ]; then echo "no ($ipfw not found)" - exit 1 + exit 0 fi err=$($ipfw nat show config 2>&1) if [ $? -ne 0 ]; then echo "no ($err)" - exit 1 + exit 0 fi echo "yes" diff --git a/plugins/network/ipt_accounting_ b/plugins/network/ipt_accounting_ index 3050c368..a22a23c2 100755 --- a/plugins/network/ipt_accounting_ +++ b/plugins/network/ipt_accounting_ @@ -45,15 +45,13 @@ if [ "$1" = "autoconf" ]; then iptables -L INPUT -v -n -x -w >/dev/null 2>/dev/null if [ $? -gt 0 ]; then echo "no (could not run iptables as user `whoami`)" - exit 1 else echo yes - exit 0 fi else echo "no (/proc/net/dev not found)" - exit 1 fi + exit 0 fi if [ "$1" = "suggest" ]; then diff --git a/plugins/network/ipt_basic_ b/plugins/network/ipt_basic_ index dd692fcd..7d3019ab 100755 --- a/plugins/network/ipt_basic_ +++ b/plugins/network/ipt_basic_ @@ -48,15 +48,13 @@ if [ "$1" = "autoconf" ]; then RES=`$iptables -L $TNAME -nvx -w 2>&1 >/dev/null` if [ $? -gt 0 ]; then echo "no (could not run iptables as user `whoami`; $RES)" - exit 1 else echo yes - exit 0 fi else echo "no (/proc/net/dev not found)" - exit 1 fi + exit 0 fi if [ "$1" = "suggest" ]; then diff --git a/plugins/network/ldap_connections b/plugins/network/ldap_connections index 49dd1cc6..8f80d437 100755 --- a/plugins/network/ldap_connections +++ b/plugins/network/ldap_connections @@ -99,12 +99,11 @@ if [ "$1" = "autoconf" ]; then done if [ -n "$ONE_LISTENING" ]; then - echo yes - exit 0 + echo "yes" else - echo no '(no slapd listening on '$PORTS')' - exit 1 + echo "no (no slapd listening on $PORTS)" fi + exit 0 fi if [ "$1" = "config" ]; then diff --git a/plugins/network/mtr100_ b/plugins/network/mtr100_ index 44ed34f3..b84d85f9 100755 --- a/plugins/network/mtr100_ +++ b/plugins/network/mtr100_ @@ -34,17 +34,15 @@ totrace=`basename $0 | sed 's/^mtr100_//g'` if [ "$1" = "autoconf" ]; then if ( mtr -nrc 1 localhost 2>/dev/null >/dev/null ); then echo yes - exit 0 else if [ $? -eq 127 ] then echo "no (mtr program not found - install the mtr(-tiny) package)" - exit 1 else echo no - exit 1 fi fi + exit 0 exit 0 fi diff --git a/plugins/network/proc_netstat b/plugins/network/proc_netstat index 3562201e..86c7f3e2 100755 --- a/plugins/network/proc_netstat +++ b/plugins/network/proc_netstat @@ -32,11 +32,10 @@ STRIP_OUTPUT="/\($TO_REMOVE\)/d" if [ "$1" = "autoconf" ]; then if [ -r $NETSTATS ]; then echo yes - exit 0 else echo no - exit 1 fi + exit 0 fi if [ "$1" = "config" ]; then diff --git a/plugins/network/qos_ b/plugins/network/qos_ index 973f5204..99743cbc 100755 --- a/plugins/network/qos_ +++ b/plugins/network/qos_ @@ -46,9 +46,9 @@ if ( exists $ARGV[0] and $ARGV[0] eq 'autoconf' ) { } else { print "no (program $TC died)\n"; } - exit 1; + } else { + print "yes\n"; } - print "yes\n"; exit 0; } diff --git a/plugins/network/smtp_hello_ b/plugins/network/smtp_hello_ index 5c293beb..b8300d03 100755 --- a/plugins/network/smtp_hello_ +++ b/plugins/network/smtp_hello_ @@ -43,11 +43,10 @@ elif [ "$1" == "autoconf" ]; then if [ -x /usr/bin/time ] && [ -x /usr/bin/nc ]; then echo "yes" - exit 0 else echo "no (/usr/bin/time or /usr/bin/nc missing)" - exit 1 fi + exit 0 else diff --git a/plugins/network/tc_ b/plugins/network/tc_ index 9933edd2..c1d4ca2a 100755 --- a/plugins/network/tc_ +++ b/plugins/network/tc_ @@ -52,11 +52,10 @@ case "$1" in autoconf) if [ -r /proc/net/dev ]; then echo yes - exit 0 else echo "no (/proc/net/dev not found)" - exit 1 fi + exit 0 ;; suggest) if [ -r /proc/net/dev ]; then diff --git a/plugins/network/tc_drops_ b/plugins/network/tc_drops_ index 8906080c..ed5c667f 100755 --- a/plugins/network/tc_drops_ +++ b/plugins/network/tc_drops_ @@ -23,11 +23,10 @@ case $1 in autoconf) if [ -r /proc/net/dev ]; then echo yes - exit 0 else echo "no (/proc/net/dev not found)" - exit 1 fi + exit 0 ;; suggest) if [ -r /proc/net/dev ]; then diff --git a/plugins/network/tc_packets_ b/plugins/network/tc_packets_ index 0c5cadc2..2690e539 100755 --- a/plugins/network/tc_packets_ +++ b/plugins/network/tc_packets_ @@ -23,11 +23,10 @@ case $1 in autoconf) if [ -r /proc/net/dev ]; then echo yes - exit 0 else echo "no (/proc/net/dev not found)" - exit 1 fi + exit 0 ;; suggest) if [ -r /proc/net/dev ]; then diff --git a/plugins/network/zenus_ b/plugins/network/zenus_ index 65d4bf04..9d8cb76f 100755 --- a/plugins/network/zenus_ +++ b/plugins/network/zenus_ @@ -233,9 +233,9 @@ sub load_data { if ( defined $ARGV[0] and $ARGV[0] eq "autoconf" ) { if ($ret) { print "no ($ret)\n"; - exit 1; + } else { + print "yes\n"; } - print "yes\n"; exit 0; } diff --git a/plugins/nfs/nfsv4 b/plugins/nfs/nfsv4 index 1de3e7e0..2c0392fb 100755 --- a/plugins/nfs/nfsv4 +++ b/plugins/nfs/nfsv4 @@ -48,11 +48,10 @@ proc="access close commit create delegpurge delegreturn getattr getfh link lock if [ "$1" = "autoconf" ]; then if [ -f "$NFSD" ]; then echo yes - exit 0 else echo "no (no $NFSD)" - exit 1 fi + exit 0 fi if [ "$1" = "config" ]; then diff --git a/plugins/nginx/nginx-combined b/plugins/nginx/nginx-combined index e1006b01..e5ba25b1 100755 --- a/plugins/nginx/nginx-combined +++ b/plugins/nginx/nginx-combined @@ -48,7 +48,7 @@ if ( exists $ARGV[0] and $ARGV[0] eq "autoconf" ) { if ($ret){ print "no ($ret)\n"; - exit 1; + exit 0; } my $ua = LWP::UserAgent->new(timeout => 30); @@ -57,7 +57,7 @@ if ( exists $ARGV[0] and $ARGV[0] eq "autoconf" ) unless ($response->is_success and $response->content =~ /server/im) { print "no (no nginx status on $URL)\n"; - exit 1; + exit 0; } else { diff --git a/plugins/nginx/nginx_connection_request b/plugins/nginx/nginx_connection_request index 989afa64..a12171fa 100755 --- a/plugins/nginx/nginx_connection_request +++ b/plugins/nginx/nginx_connection_request @@ -112,7 +112,7 @@ my $UA = exists $ENV{'ua'} ? $ENV{'ua'} : 'nginx-status-verifier/0.1'; if (exists $ARGV[0] and $ARGV[0] eq "autoconf" ) { if ($ret) { print "no ($ret)\n"; - exit 1; + exit 0; } my $ua = LWP::UserAgent->new(timeout => 30); # Set the UA to something different from the libwww-perl. @@ -122,7 +122,7 @@ if (exists $ARGV[0] and $ARGV[0] eq "autoconf" ) { unless ($response->is_success and $response->content =~ /server/im) { print "no (no nginx status on $URL)\n"; - exit 1; + exit 0; } else { print "yes\n"; exit 0; diff --git a/plugins/ntp/ntp_peers b/plugins/ntp/ntp_peers index 3cd798bb..9f1a4ab0 100755 --- a/plugins/ntp/ntp_peers +++ b/plugins/ntp/ntp_peers @@ -69,15 +69,13 @@ if ($ARGV[0] and $ARGV[0] eq "autoconf") { if ($? eq "0") { if (`$NTPQ -np | wc -l` > 0) { print "yes\n"; - exit 0; } else { print "no (unable to list peers)\n"; - exit 1; } } else { print "no (ntpq not found)\n"; - exit 1; } + exit 0; } my %peers; diff --git a/plugins/ntp/ntp_peers_ipv6 b/plugins/ntp/ntp_peers_ipv6 index e422f012..584d45b3 100755 --- a/plugins/ntp/ntp_peers_ipv6 +++ b/plugins/ntp/ntp_peers_ipv6 @@ -55,15 +55,13 @@ if ($ARGV[0] and $ARGV[0] eq "autoconf") { if ($? eq "0") { if (`$NTPQ -np | wc -l` > 0) { print "yes\n"; - exit 0; } else { print "no (unable to list peers)\n"; - exit 1; } } else { print "no (ntpq not found)\n"; - exit 1; } + exit 0; } my %peers; diff --git a/plugins/ntp/ntp_queries b/plugins/ntp/ntp_queries index 68c155f8..f0690e39 100755 --- a/plugins/ntp/ntp_queries +++ b/plugins/ntp/ntp_queries @@ -51,15 +51,13 @@ if ($ARGV[0] and $ARGV[0] eq "autoconf") { if ($? eq "0") { if (`$NTPDC -c sysstats | wc -l` > 0) { print "yes\n"; - exit 0; } else { print "no (unable to list system stats)\n"; - exit 1; } } else { print "no (ntpdc not found)\n"; - exit 1; } + exit 0; } my $queries = 0; diff --git a/plugins/openvz/vpsmem b/plugins/openvz/vpsmem index dc3aad03..adc9442c 100755 --- a/plugins/openvz/vpsmem +++ b/plugins/openvz/vpsmem @@ -12,11 +12,10 @@ BEANCOUNTERS=/proc/user_beancounters if [ "$1" == "autoconf" ]; then if [ -e $BEANCOUNTERS ]; then echo yes - exit 0 else echo no - exit 1 fi + exit 0 fi if [ ! -r $BEANCOUNTERS ]; then diff --git a/plugins/oracle/oracle__connections b/plugins/oracle/oracle__connections index a96b3b23..9c2d362c 100755 --- a/plugins/oracle/oracle__connections +++ b/plugins/oracle/oracle__connections @@ -66,14 +66,14 @@ if (exists $ARGV[0]) { # Check for DBD::Oracle if (! eval "require DBD::Oracle;") { print "no (DBD::Oracle not found)"; - exit 1; + exit 0; } if ($dbh) { print "yes\n"; exit 0; } else { print "no Unable to access Database $dbname on host $dbhost as user $dbuser.\nError returned was: ". $DBI::errstr; - exit 1; + exit 0; } } diff --git a/plugins/oracle/oracle__database_hitratio b/plugins/oracle/oracle__database_hitratio index e07dba87..fae7045a 100755 --- a/plugins/oracle/oracle__database_hitratio +++ b/plugins/oracle/oracle__database_hitratio @@ -63,14 +63,14 @@ if (exists $ARGV[0]) { # Check for DBD::Oracle if (! eval "require DBD::Oracle;") { print "no (DBD::Oracle not found)"; - exit 1; + exit 0; } if ($dbh) { print "yes\n"; exit 0; } else { print "no Unable to access Database $dbname on host $dbhost as user $dbuser.\nError returned was: ". $DBI::errstr; - exit 1; + exit 0; } } diff --git a/plugins/oracle/oracle__locks b/plugins/oracle/oracle__locks index d8140fbc..c515dbce 100755 --- a/plugins/oracle/oracle__locks +++ b/plugins/oracle/oracle__locks @@ -64,14 +64,14 @@ if (exists $ARGV[0]) { # Check for DBD::Oracle if (! eval "require DBD::Oracle;") { print "no (DBD::Oracle not found)"; - exit 1; + exit 0; } if ($dbh) { print "yes\n"; exit 0; } else { print "no Unable to access Database $dbname on host $dbhost as user $dbuser.\nError returned was: ". $DBI::errstr; - exit 1; + exit 0; } } diff --git a/plugins/oracle/oracle__tablespace_usage b/plugins/oracle/oracle__tablespace_usage index c35235a0..637a77c9 100755 --- a/plugins/oracle/oracle__tablespace_usage +++ b/plugins/oracle/oracle__tablespace_usage @@ -65,14 +65,14 @@ if (exists $ARGV[0]) { # Check for DBD::Oracle if (! eval "require DBD::Oracle;") { print "no (DBD::Oracle not found)"; - exit 1; + exit 0; } if ($dbh) { print "yes\n"; exit 0; } else { print "no Unable to access Database $dbname on host $dbhost as user $dbuser.\nError returned was: ". $DBI::errstr; - exit 1; + exit 0; } } diff --git a/plugins/other/earthquakes b/plugins/other/earthquakes index 095851b1..74645584 100755 --- a/plugins/other/earthquakes +++ b/plugins/other/earthquakes @@ -46,11 +46,10 @@ if (defined $ARGV[0] and $ARGV[0] eq "autoconf") if (defined $ret) { print "no ($ret)\n"; - exit 1; } else { print "yes\n"; - exit 0; } + exit 0; } if (defined $ARGV[0] and $ARGV[0] eq "config") diff --git a/plugins/other/opentracker_ b/plugins/other/opentracker_ index 98a9be44..2be0dc6d 100755 --- a/plugins/other/opentracker_ +++ b/plugins/other/opentracker_ @@ -228,11 +228,10 @@ if (defined $ARGV[0] && $ARGV[0] eq 'autoconf') { my $response = $ua->get($url); if ($response->is_success) { print "yes\n"; - exit 0; } else { print "no: unable to connect to url: $url\n"; - exit 1; } + exit 0; } =head2 Suggest Check diff --git a/plugins/pf/pf b/plugins/pf/pf index 5f1366ab..afc46618 100755 --- a/plugins/pf/pf +++ b/plugins/pf/pf @@ -81,31 +81,31 @@ case $1 in # enabled? if [ `${pfctl} -si 2>/dev/null | awk '/^Status:/{print $2}'` != "Enabled" ]; then echo "no (pf(4) is not enabled, consult pfctl(8))" - exit 1 + exit 0 fi # FreeBSD elif [ ${ostype} = "FreeBSD" ]; then # enabled? if [ `${pfctl} -si 2>/dev/null | awk '/^Status:/{print $2}'` != "Enabled" ]; then echo "no (pf(4) is not enabled, consult pfctl(8))" - exit 1 + exit 0 fi # OpenBSD elif [ ${ostype} = "OpenBSD" ]; then # pf(4) module loaded? if [ `kldstat -v | grep pf | wc -l` -eq 0 ]; then echo "no (pf(4) is not loaded)" - exit 1 + exit 0 fi # enabled? if [ `${pfctl} -si 2>/dev/null | awk '/^Status:/{print $2}'` != "Enabled" ]; then echo "no (pf(4) is not enabled, consult pfctl(8))" - exit 1 + exit 0 fi # Other OSes else echo "no (this plugin is not supported on your OS)" - exit 1 + exit 0 fi echo "yes" exit 0 diff --git a/plugins/pf/pf_bytes b/plugins/pf/pf_bytes index a2c840e8..55114231 100755 --- a/plugins/pf/pf_bytes +++ b/plugins/pf/pf_bytes @@ -51,12 +51,12 @@ END { # enabled? if [ `pfctl -si 2>/dev/null | awk '/^Status:/{print $2}'` != "Enabled" ]; then echo "no (pf(4) is not enabled, consult pfctl(8)" - exit 1 + exit 0 fi # Other OSes else echo "no (this plugin is not supported on your OS)" - exit 1 + exit 0 fi echo "yes" exit 0 diff --git a/plugins/pf/pf_openbsd b/plugins/pf/pf_openbsd index 0d7c1680..65fd05d1 100755 --- a/plugins/pf/pf_openbsd +++ b/plugins/pf/pf_openbsd @@ -48,24 +48,24 @@ EOF # pf(4) module loaded? if [ `kldstat -v | grep pf | wc -l` -eq 0 ]; then echo "no (pf(4) is not loaded)" - exit 1 + exit 0 fi # enabled? if [ `pfctl -si 2>/dev/null | awk '/^Status:/{print $2}'` != "Enabled" ]; then echo "no (pf(4) is not enabled, consult pfctl(8)" - exit 1 + exit 0 fi # OpenBSD elif [ ${ostype} = "OpenBSD" ]; then # enabled? if [ `pfctl -si 2>/dev/null | awk '/^Status:/{print $2}'` != "Enabled" ]; then echo "no (pf(4) is not enabled, consult pfctl(8)" - exit 1 + exit 0 fi # Other OSes else echo "no (this plugin is not supported on your OS)" - exit 1 + exit 0 fi echo "yes" exit 0 diff --git a/plugins/pf/pf_packets b/plugins/pf/pf_packets index 117fe0a5..59b30c5d 100755 --- a/plugins/pf/pf_packets +++ b/plugins/pf/pf_packets @@ -50,24 +50,24 @@ END { # pf(4) module loaded? if [ `kldstat -v | grep pf | wc -l` -eq 0 ]; then echo "no (pf(4) is not loaded)" - exit 1 + exit 0 fi # enabled? if [ `pfctl -si 2>/dev/null | awk '/^Status:/{print $2}'` != "Enabled" ]; then echo "no (pf(4) is not enabled, consult pfctl(8)" - exit 1 + exit 0 fi # OpenBSD elif [ ${ostype} = "OpenBSD" ]; then # enabled? if [ `pfctl -si 2>/dev/null | awk '/^Status:/{print $2}'` != "Enabled" ]; then echo "no (pf(4) is not enabled, consult pfctl(8)" - exit 1 + exit 0 fi # Other OSes else echo "no (this plugin is not supported on your OS)" - exit 1 + exit 0 fi echo "yes" exit 0 diff --git a/plugins/pf/pf_states b/plugins/pf/pf_states index 762b2c03..4d84ee0a 100755 --- a/plugins/pf/pf_states +++ b/plugins/pf/pf_states @@ -44,24 +44,24 @@ ${pfctl} -sm 2> /dev/null | awk ' # pf(4) module loaded? if [ `kldstat -v | grep pf | wc -l` -eq 0 ]; then echo "no (pf(4) is not loaded)" - exit 1 + exit 0 fi # enabled? if [ `pfctl -si 2>/dev/null | awk '/^Status:/{print $2}'` != "Enabled" ]; then echo "no (pf(4) is not enabled, consult pfctl(8)" - exit 1 + exit 0 fi # OpenBSD elif [ ${ostype} = "OpenBSD" ]; then # enabled? if [ `pfctl -si 2>/dev/null | awk '/^Status:/{print $2}'` != "Enabled" ]; then echo "no (pf(4) is not enabled, consult pfctl(8)" - exit 1 + exit 0 fi # Other OSes else echo "no (this plugin is not supported on your OS)" - exit 1 + exit 0 fi echo "yes" exit 0 diff --git a/plugins/php/php_sessions b/plugins/php/php_sessions index eb947f42..2950b9d3 100755 --- a/plugins/php/php_sessions +++ b/plugins/php/php_sessions @@ -43,11 +43,10 @@ if [ "$1" = "autoconf" ]; then test -d "$SESSDIR" > /dev/null 2>&1 if [ $? ]; then echo yes - exit 0 else echo "no (session directory not found)" - exit 1 fi + exit 0 fi if [ "$1" = "config" ]; then diff --git a/plugins/php/php_time_execution b/plugins/php/php_time_execution index 431754c6..8a1ce651 100755 --- a/plugins/php/php_time_execution +++ b/plugins/php/php_time_execution @@ -40,11 +40,10 @@ NBRPAGE=${nbrpage} if [ "$1" = "autoconf" ]; then if [ -r "$LOG" ]; then echo yes - exit 0 else echo no - exit 1 fi + exit 0 fi if [ "$1" = "config" ]; then diff --git a/plugins/ping/multiping b/plugins/ping/multiping index a6f9bfa3..38d3b1fc 100755 --- a/plugins/ping/multiping +++ b/plugins/ping/multiping @@ -68,11 +68,10 @@ if ((exists $ARGV[0]) && ($ARGV[0] eq "autoconf")) { my $ping = join(" ", @ping); if ($ping =~ m@min/avg/max@) { print "yes\n"; - exit 0; } else { print "no\n"; - exit 1; } + exit 0; } if ((exists $ARGV[0]) && ($ARGV[0] eq "config")) { diff --git a/plugins/ping/pinger b/plugins/ping/pinger index 16db1279..8a4fab3c 100755 --- a/plugins/ping/pinger +++ b/plugins/ping/pinger @@ -67,11 +67,10 @@ case $1 in which ping if [[ "$?" = "0" ]]; then echo yes - exit 0 else echo "no (ping not present)" - exit 1 fi + exit 0 ;; config) cat << EOM diff --git a/plugins/postfix/postfix-policyd b/plugins/postfix/postfix-policyd index fb094740..aa6c793c 100755 --- a/plugins/postfix/postfix-policyd +++ b/plugins/postfix/postfix-policyd @@ -15,11 +15,10 @@ MYSQL_DB="postfixpolicyd" if [ "$1" = "autoconf" ]; then if [ -n "${MYSQL_PASS}" ] ; then echo yes - exit 0 else echo "no (set mysql pass)" - exit 1 fi + exit 0 fi if [ "$1" = "config" ]; then diff --git a/plugins/postfix/postfix_filtered b/plugins/postfix/postfix_filtered index c9eda5f4..22eb0200 100755 --- a/plugins/postfix/postfix_filtered +++ b/plugins/postfix/postfix_filtered @@ -44,11 +44,10 @@ STATEFILE=$MUNIN_PLUGSTATE/postfix_mailfiltered.offset if [ "$1" = "autoconf" ]; then if [ -f "${MAIL_LOG}" -a -n "${LOGTAIL}" -a -x "${LOGTAIL}" ] ; then echo yes - exit 0 else echo no - exit 1 fi + exit 0 fi if [ "$1" = "config" ]; then diff --git a/plugins/postfix/postfix_filtered_awk b/plugins/postfix/postfix_filtered_awk index b054c111..54dd7b38 100755 --- a/plugins/postfix/postfix_filtered_awk +++ b/plugins/postfix/postfix_filtered_awk @@ -40,11 +40,10 @@ STATEFILE=$MUNIN_PLUGSTATE/postfix_mailfiltered_test.offset if [ "$1" = "autoconf" ]; then if [ -f "${MAIL_LOG}" -a -n "${LOGTAIL}" -a -x "${LOGTAIL}" ] ; then echo yes - exit 0 else echo no - exit 1 fi + exit 0 fi if [ "$1" = "config" ]; then diff --git a/plugins/postfix/postfix_mailfiltered b/plugins/postfix/postfix_mailfiltered index 8689bdd7..c0ef6d6e 100755 --- a/plugins/postfix/postfix_mailfiltered +++ b/plugins/postfix/postfix_mailfiltered @@ -20,11 +20,10 @@ STATEFILE=$MUNIN_PLUGSTATE/postfix_mailfiltered.offset if [ "$1" = "autoconf" ]; then if [ -f "${MAIL_LOG}" -a -n "${LOGTAIL}" -a -x "${LOGTAIL}" ] ; then echo yes - exit 0 else echo no - exit 1 fi + exit 0 fi if [ "$1" = "config" ]; then diff --git a/plugins/postfix/postfix_mailstats b/plugins/postfix/postfix_mailstats index c21e2df2..7d2c518e 100755 --- a/plugins/postfix/postfix_mailstats +++ b/plugins/postfix/postfix_mailstats @@ -62,7 +62,7 @@ sub autoconf } else { print "no (could not find logdir)\n"; } - exit 1; + exit 0; } sub config diff --git a/plugins/postfix/postfix_mailvolume_multi b/plugins/postfix/postfix_mailvolume_multi index 5ef5c201..03192515 100755 --- a/plugins/postfix/postfix_mailvolume_multi +++ b/plugins/postfix/postfix_mailvolume_multi @@ -133,7 +133,6 @@ if ($ARGV[0] and $ARGV[0] eq "autoconf") if (-r "$logfile") { print "yes\n"; - exit 0; } else { diff --git a/plugins/postfix/postgrey b/plugins/postfix/postgrey index 0fc3bbef..be90e875 100755 --- a/plugins/postfix/postgrey +++ b/plugins/postfix/postgrey @@ -20,11 +20,10 @@ LOGTAIL=${logtail:-`which logtail`} if [ "$1" = "autoconf" ]; then if [ -f "${MAIL_LOG}" -a -n "${LOGTAIL}" -a -x "${LOGTAIL}" ] ; then echo yes - exit 0 else echo no - exit 1 fi + exit 0 fi if [ "$1" = "config" ]; then diff --git a/plugins/postfix/postgrey-new b/plugins/postfix/postgrey-new index a56e0f12..37a1dd40 100755 --- a/plugins/postfix/postgrey-new +++ b/plugins/postfix/postgrey-new @@ -47,12 +47,11 @@ my $passes_white_new=0; if(defined $ARGV[0] and $ARGV[0] eq "autoconf") { if ( -f $maillog) { print "yes\n"; - exit 0; } else { print "no\n"; - exit 1 } + exit 0; } diff --git a/plugins/postgresql/pgbouncer_ b/plugins/postgresql/pgbouncer_ index 69dacafd..9257886f 100755 --- a/plugins/postgresql/pgbouncer_ +++ b/plugins/postgresql/pgbouncer_ @@ -44,14 +44,13 @@ if (defined($ARGV[0])) if (!$dbh) { print "no\n"; - exit 1; } else { print "yes\n"; - exit 0; } $dbh->disconnect(); + exit 0; } if ($ARGV[0] eq 'config') diff --git a/plugins/postgresql/postgres_block_read_ b/plugins/postgresql/postgres_block_read_ index 2ea8da8a..f8afa224 100755 --- a/plugins/postgresql/postgres_block_read_ +++ b/plugins/postgresql/postgres_block_read_ @@ -76,7 +76,7 @@ if (exists $ARGV[0]) { # Check for DBD::Pg if (! eval "require DBD::Pg;") { print "no (DBD::Pg not found)"; - exit 1; + exit 0; } # Then we try to detect Postgres presence by connecting to # 'template1'. @@ -88,7 +88,7 @@ if (exists $ARGV[0]) { exit 0; } else { print "no (Can't connect to given host, please check environment settings)\n"; - exit 1; + exit 0; } } elsif ($ARGV[0] eq 'debug') { # Set debug flag diff --git a/plugins/postgresql/postgres_space_ b/plugins/postgresql/postgres_space_ index 1b6d88da..7085c14f 100755 --- a/plugins/postgresql/postgres_space_ +++ b/plugins/postgresql/postgres_space_ @@ -31,7 +31,7 @@ if (exists $ARGV[0]) { # Check for DBD::Pg if (! eval "require DBD::Pg;") { print "no (DBD::Pg not found)"; - exit 1; + exit 0; } # Then we try to detect Postgres presence by connecting to # 'template1'. @@ -43,7 +43,7 @@ if (exists $ARGV[0]) { exit 0; } else { print "no (Can't connect to given host, please check environment settings)\n"; - exit 1; + exit 0; } } elsif ($ARGV[0] and $ARGV[0] eq 'debug') { # Set config flag diff --git a/plugins/power/apcupsd_ww b/plugins/power/apcupsd_ww index 4a657f28..0b7c1a6c 100755 --- a/plugins/power/apcupsd_ww +++ b/plugins/power/apcupsd_ww @@ -178,11 +178,10 @@ if (-f $config) { if (defined $ARGV[0] && $ARGV[0] =~ /autoconf|detect/) { if (-x $apcaccess) { print "yes\n"; - exit 0; } else { print "no (apcaccess not found)\n"; - exit 1; } + exit 0; } # Read info from apcupsd using apcaccess diff --git a/plugins/power/nut b/plugins/power/nut index 8c3f158d..31e34002 100755 --- a/plugins/power/nut +++ b/plugins/power/nut @@ -47,11 +47,10 @@ case "$1" in grep ^MONITOR < /etc/nut/upsmon.conf &> /dev/null if [[ "$?" = "0" ]]; then echo yes - exit 0 else echo "no (NUT not installed or no UPS info available in /etc/nut/upsmon.conf)" - exit 1 fi + exit 0 ;; config) FETCH_DATA diff --git a/plugins/qmail/qmailsend b/plugins/qmail/qmailsend index b0b750f3..107f7f7f 100755 --- a/plugins/qmail/qmailsend +++ b/plugins/qmail/qmailsend @@ -18,11 +18,10 @@ if (exists $ARGV[0]) { if ($ARGV[0] eq "autoconf") { if (-f "${logpath}current") { print "yes\n"; - exit 0; } else { print STDERR "no (Cannot find ${logpath}current. Please specify env.logpath)\n"; - exit 1; } + exit 0; } } diff --git a/plugins/qmail/qmailsend_plesk b/plugins/qmail/qmailsend_plesk index 2e9e767f..585c020b 100755 --- a/plugins/qmail/qmailsend_plesk +++ b/plugins/qmail/qmailsend_plesk @@ -18,11 +18,10 @@ if (exists $ARGV[0]) { if ($ARGV[0] eq "autoconf") { if (-f "${logpath}maillog") { print "yes\n"; - exit 0; } else { print STDERR "no (Cannot find ${logpath}maillog. Please specify env.logpath)\n"; - exit 1; } + exit 0; } } diff --git a/plugins/qmail/spamdyke b/plugins/qmail/spamdyke index 04458acf..b6e58284 100755 --- a/plugins/qmail/spamdyke +++ b/plugins/qmail/spamdyke @@ -34,11 +34,10 @@ STATEFILE=$MUNIN_PLUGSTATE/spamdyke.offset if [ "$1" = "autoconf" ]; then if [ -f "${MAIL_LOG}" -a -n "${LOGTAIL}" -a -x "${LOGTAIL}" ] ; then echo yes - exit 0 else echo no - exit 1 fi + exit 0 fi if [ "$1" = "config" ]; then diff --git a/plugins/radiator/radiator_acct_lag b/plugins/radiator/radiator_acct_lag index be9ab4e8..362b53a0 100755 --- a/plugins/radiator/radiator_acct_lag +++ b/plugins/radiator/radiator_acct_lag @@ -23,11 +23,10 @@ if [ "$statisticsdir" ]; then STATISTICSDIR=$statisticsdir ; fi if [ "$1" = "autoconf" ]; then if [ -d ${STATISTICSDIR} ] ; then echo yes - exit 0 else echo no - exit 1 fi + exit 0 fi diff --git a/plugins/radiator/radiator_acct_ppm b/plugins/radiator/radiator_acct_ppm index 04ef8687..af8d74f6 100755 --- a/plugins/radiator/radiator_acct_ppm +++ b/plugins/radiator/radiator_acct_ppm @@ -23,11 +23,10 @@ if [ "$statisticsdir" ]; then STATISTICSDIR=$statisticsdir ; fi if [ "$1" = "autoconf" ]; then if [ -d ${STATISTICSDIR} ] ; then echo yes - exit 0 else echo no - exit 1 fi + exit 0 fi diff --git a/plugins/radiator/radiator_auth_lag b/plugins/radiator/radiator_auth_lag index 9b33b0d1..4a14e06b 100755 --- a/plugins/radiator/radiator_auth_lag +++ b/plugins/radiator/radiator_auth_lag @@ -23,11 +23,10 @@ if [ "$statisticsdir" ]; then STATISTICSDIR=$statisticsdir ; fi if [ "$1" = "autoconf" ]; then if [ -d ${STATISTICSDIR} ] ; then echo yes - exit 0 else echo no - exit 1 fi + exit 0 fi diff --git a/plugins/radiator/radiator_auth_ppm b/plugins/radiator/radiator_auth_ppm index 0e4c5d14..e4d2cd84 100755 --- a/plugins/radiator/radiator_auth_ppm +++ b/plugins/radiator/radiator_auth_ppm @@ -23,11 +23,10 @@ if [ "$statisticsdir" ]; then STATISTICSDIR=$statisticsdir ; fi if [ "$1" = "autoconf" ]; then if [ -d ${STATISTICSDIR} ] ; then echo yes - exit 0 else echo no - exit 1 fi + exit 0 fi diff --git a/plugins/router/freeboxuptime b/plugins/router/freeboxuptime index 7202f82d..1ced6e0a 100755 --- a/plugins/router/freeboxuptime +++ b/plugins/router/freeboxuptime @@ -65,16 +65,14 @@ fi if [ "$1" = "autoconf" ]; then if [ -z "$NMAP" ]; then echo "no (nmap not installed)" - exit 1 else if [ $PING -eq 0 ]; then echo "no (Freebox not reachable)" - exit 2 else echo yes - exit 0 fi fi + exit 0 fi diff --git a/plugins/router/tg585v7__ b/plugins/router/tg585v7__ index 1bf4e576..db438baf 100755 --- a/plugins/router/tg585v7__ +++ b/plugins/router/tg585v7__ @@ -112,9 +112,9 @@ print "# Access Mode is: $ACCESS_MODE\n" if $MUNIN_DEBUG; if ( defined $ARGV[0] and $ARGV[0] eq "autoconf" ) { if ($ret) { print "no ($ret)\n"; - exit 1; + } else { + print "yes\n"; } - print "yes\n"; exit 0; } diff --git a/plugins/rsync/rsyncd_bytes b/plugins/rsync/rsyncd_bytes index 985086e7..750e6abb 100755 --- a/plugins/rsync/rsyncd_bytes +++ b/plugins/rsync/rsyncd_bytes @@ -21,11 +21,10 @@ STATEFILE=$MUNIN_PLUGSTATE/rsync-bytes.offset if [ "$1" = "autoconf" ]; then if [ -f "${RSYNCD_LOG}" -a -n "${LOGTAIL}" -a -x "${LOGTAIL}" ] ; then echo yes - exit 0 else echo no - exit 1 fi + exit 0 fi if [ "$1" = "config" ]; then diff --git a/plugins/rsync/rsyncd_count b/plugins/rsync/rsyncd_count index ec04c3f4..ebb10764 100755 --- a/plugins/rsync/rsyncd_count +++ b/plugins/rsync/rsyncd_count @@ -21,11 +21,10 @@ STATEFILE=$MUNIN_PLUGSTATE/rsync-count.offset if [ "$1" = "autoconf" ]; then if [ -f "${RSYNCD_LOG}" -a -n "${LOGTAIL}" -a -x "${LOGTAIL}" ] ; then echo yes - exit 0 else echo no - exit 1 fi + exit 0 fi if [ "$1" = "config" ]; then diff --git a/plugins/s3/s3_items b/plugins/s3/s3_items index d31c149f..1f716c65 100755 --- a/plugins/s3/s3_items +++ b/plugins/s3/s3_items @@ -10,12 +10,11 @@ my $s3cmd = 's3curl.pl --id ' . $s3_id . ' http://s3.amazonaws.com/'; if ( $ARGV[0] eq "autoconf" ) { if (`/usr/bin/perl $0` eq "" ) { - print "no\n"; - exit 1; + print "no\n"; } else { - print "yes\n"; - exit 0; + print "yes\n"; } + exit 0; } diff --git a/plugins/s3/s3_storage b/plugins/s3/s3_storage index 3fda1d7c..314590f1 100755 --- a/plugins/s3/s3_storage +++ b/plugins/s3/s3_storage @@ -28,16 +28,12 @@ if (not @bucket_list) if ($ARGV[0] and $ARGV[0] eq "autoconf") { - if (@bucket_list) - { + if (@bucket_list) { print "yes\n"; - exit 0; - } - else - { + } else { print "no\n"; - exit 1; } + exit 0; } sub get_bucket_stats diff --git a/plugins/sar/iostat-cputps-average b/plugins/sar/iostat-cputps-average index bcbde46e..4f5e20b1 100755 --- a/plugins/sar/iostat-cputps-average +++ b/plugins/sar/iostat-cputps-average @@ -17,16 +17,14 @@ export LANG=en_US.UTF-8 if [ "$1" == "autoconf" ]; then if ( sar 1 1 >/dev/null 2>&1 ); then echo yes - exit 0 else if [ $? -eq 127 ]; then echo "no (could not run \"sar\")" - exit 1 else echo no - exit 1 fi fi + exit 0 fi ARRAY=( `sar -p -d -s ${tenMago} -e ${current} | grep -v nodev | grep "Average" | awk '{ print $2 , $3 , $10 }'` ) diff --git a/plugins/security/forefront_ b/plugins/security/forefront_ index eb9b61d4..e1400eb5 100755 --- a/plugins/security/forefront_ +++ b/plugins/security/forefront_ @@ -101,10 +101,10 @@ if(!eval "require MIME::Base64;") { if($ARGV[0] and $ARGV[0] eq "autoconf") { if($ret) { - print "no ($ret)\n"; - exit 1; + print "no ($ret)\n"; + } else { + print "yes\n"; } - print "yes\n"; exit 0; } diff --git a/plugins/sensors/mbmon b/plugins/sensors/mbmon index 0044bafe..345dd98c 100755 --- a/plugins/sensors/mbmon +++ b/plugins/sensors/mbmon @@ -19,11 +19,10 @@ my $mbmon = "/usr/local/bin/mbmon"; if ($ARGV[0] eq 'autoconf') { if (-x $mbmon) { print "yes\n"; - exit 0; } else { print "no\n"; - exit 1; } + exit 0; } elsif ($ARGV[0] eq 'config') { print < /dev/null; then echo "yes" - exit 0 else echo "no" - exit 1 fi + exit 0 fi # env.options diff --git a/plugins/sge/sge_queue_xml_ b/plugins/sge/sge_queue_xml_ index 6adc3e2c..6fe02f3b 100755 --- a/plugins/sge/sge_queue_xml_ +++ b/plugins/sge/sge_queue_xml_ @@ -91,11 +91,10 @@ XMLSTARLET=$( which xmlstarlet ) if [ "$1" = "autoconf" ]; then if [ -n "$QSTAT" -a -n "$XMLSTARLET" ]; then echo "yes" - exit 0 else echo "no" - exit 1 fi + exit 0 fi # check requirements diff --git a/plugins/smstools/smstools_ b/plugins/smstools/smstools_ index e5e4644d..2f41f5e6 100755 --- a/plugins/smstools/smstools_ +++ b/plugins/smstools/smstools_ @@ -58,11 +58,10 @@ MODEM=`basename $0 | sed 's/^smstools_//g'` if [ "$1" = "autoconf" ]; then if [ -d $STATSDIR ]; then echo yes - exit 0 else echo "no ($STATSDIR not found)" - exit 1 fi + exit 0 fi if [ "$1" = "suggest" ]; then diff --git a/plugins/snmp/snmp_room_alert_ b/plugins/snmp/snmp_room_alert_ index 4114aaf9..8c4ec86e 100755 --- a/plugins/snmp/snmp_room_alert_ +++ b/plugins/snmp/snmp_room_alert_ @@ -73,7 +73,7 @@ community = ENV['community'] || "public" case ARGV[0] when "autoconf" puts "no" - exit 1 + exit 0 when "config" puts "graph_title Room Alert 11E units (#{name} probes)" puts "graph_vlabel #{label}" diff --git a/plugins/solaris/solaris-memstat b/plugins/solaris/solaris-memstat index d6c58931..64e3e39c 100755 --- a/plugins/solaris/solaris-memstat +++ b/plugins/solaris/solaris-memstat @@ -41,11 +41,10 @@ if [ "$1" = "autoconf" ]; then if [ -e /usr/bin/mdb ]; then echo yes - exit 0 else echo /usr/bin/mdb not found - exit 1 fi + exit 0 fi if [ "$1" = "config" ]; then diff --git a/plugins/sourceds/srcds_cpu b/plugins/sourceds/srcds_cpu index 9a1b5099..ae56702b 100755 --- a/plugins/sourceds/srcds_cpu +++ b/plugins/sourceds/srcds_cpu @@ -130,15 +130,15 @@ sub test_service { my $sock = Rcon::sock_connect($HOST, $PORT); if (!$sock) { print "no (could not open socket to $HOST:$PORT)\n"; - exit 1; + exit 0; } if (!Rcon::rcon_auth($sock, $PASS)) { print "no (could not authenticate)\n"; - exit 1; + exit 0; } if (!defined(Rcon::rcon_command($sock, "stats"))) { print "no (did not receive reply from server)\n"; - exit 1; + exit 0; } print "yes\n"; diff --git a/plugins/sourceds/srcds_fps b/plugins/sourceds/srcds_fps index c2625b7e..813ad5c2 100755 --- a/plugins/sourceds/srcds_fps +++ b/plugins/sourceds/srcds_fps @@ -132,15 +132,15 @@ sub test_service { my $sock = Rcon::sock_connect($HOST, $PORT); if (!$sock) { print "no (could not open socket to $HOST:$PORT)\n"; - exit 1; + exit 0; } if (!Rcon::rcon_auth($sock, $PASS)) { print "no (could not authenticate)\n"; - exit 1; + exit 0; } if (!defined(Rcon::rcon_command($sock, "stats"))) { print "no (did not receive reply from server)\n"; - exit 1; + exit 0; } print "yes\n"; diff --git a/plugins/sourceds/srcds_inout b/plugins/sourceds/srcds_inout index 2ae34792..aab351f1 100755 --- a/plugins/sourceds/srcds_inout +++ b/plugins/sourceds/srcds_inout @@ -143,15 +143,15 @@ sub test_service { my $sock = Rcon::sock_connect($HOST, $PORT); if (!$sock) { print "no (could not open socket to $HOST:$PORT)\n"; - exit 1; + exit 0; } if (!Rcon::rcon_auth($sock, $PASS)) { print "no (could not authenticate)\n"; - exit 1; + exit 0; } if (!defined(Rcon::rcon_command($sock, "stats"))) { print "no (did not receive reply from server)\n"; - exit 1; + exit 0; } print "yes\n"; diff --git a/plugins/sourceds/srcds_players b/plugins/sourceds/srcds_players index ce2c1621..22bb4f5a 100755 --- a/plugins/sourceds/srcds_players +++ b/plugins/sourceds/srcds_players @@ -106,15 +106,15 @@ sub test_service { my $sock = Rcon::sock_connect($HOST, $PORT); if (!$sock) { print "no (could not open socket to $HOST:$PORT)\n"; - exit 1; + exit 0; } if (!Rcon::rcon_auth($sock, $PASS)) { print "no (could not authenticate)\n"; - exit 1; + exit 0; } if (!defined(Rcon::rcon_command($sock, "stats"))) { print "no (did not receive reply from server)\n"; - exit 1; + exit 0; } print "yes\n"; diff --git a/plugins/sourceds/srcds_uptime b/plugins/sourceds/srcds_uptime index 0e4011e2..0aee1ea2 100755 --- a/plugins/sourceds/srcds_uptime +++ b/plugins/sourceds/srcds_uptime @@ -104,15 +104,15 @@ sub test_service { my $sock = Rcon::sock_connect($HOST, $PORT); if (!$sock) { print "no (could not open socket to $HOST:$PORT)\n"; - exit 1; + exit 0; } if (!Rcon::rcon_auth($sock, $PASS)) { print "no (could not authenticate)\n"; - exit 1; + exit 0; } if (!defined(Rcon::rcon_command($sock, "stats"))) { print "no (did not receive reply from server)\n"; - exit 1; + exit 0; } print "yes\n"; diff --git a/plugins/squid/squid_times b/plugins/squid/squid_times index 3e5311fc..4817e260 100755 --- a/plugins/squid/squid_times +++ b/plugins/squid/squid_times @@ -20,11 +20,10 @@ if [ "$1" = "autoconf" ]; then SQUID_STATS=`printf "GET cache_object://$host/info HTTP/1.0\n\n" | netcat $host $port` if [ -n "${SQUID_STATS}" ]; then echo yes - exit 0 else echo "no (HTTP GET failed)" - exit 1 fi + exit 0 fi if [ "$1" = "config" ]; then diff --git a/plugins/ssh/openssh-denyhosts b/plugins/ssh/openssh-denyhosts index 9990975c..f94478bd 100755 --- a/plugins/ssh/openssh-denyhosts +++ b/plugins/ssh/openssh-denyhosts @@ -21,11 +21,10 @@ LOGTAIL=${logtail:-`which logtail`} if [ "$1" = "autoconf" ]; then if [ -f "${AUTH_LOG}" -a -n "${LOGTAIL}" -a -x "${LOGTAIL}" ] ; then echo yes - exit 0 else echo no - exit 1 fi + exit 0 fi if [ "$1" = "config" ]; then diff --git a/plugins/ssh/sshd_invalid_countries_ruby b/plugins/ssh/sshd_invalid_countries_ruby index 45cc9148..fe0448f4 100755 --- a/plugins/ssh/sshd_invalid_countries_ruby +++ b/plugins/ssh/sshd_invalid_countries_ruby @@ -62,7 +62,7 @@ when 'autoconf' fh = open(SYSLOG, 'r') rescue puts 'no' - exit 1 + exit 0 else puts 'yes' exit 0 diff --git a/plugins/system/blockhosts b/plugins/system/blockhosts index 400d7404..11945533 100755 --- a/plugins/system/blockhosts +++ b/plugins/system/blockhosts @@ -17,11 +17,10 @@ LOG=/etc/hosts.allow if [ "$1" = "autoconf" ]; then if [ -r "$LOG" ]; then echo yes - exit 0 else echo no - exit 1 fi + exit 0 fi if [ "$1" = "config" ]; then diff --git a/plugins/tcp/tcp-states b/plugins/tcp/tcp-states index eb093263..b83dd257 100755 --- a/plugins/tcp/tcp-states +++ b/plugins/tcp/tcp-states @@ -21,17 +21,15 @@ if [ "$1" = "autoconf" ]; then if ( netstat -nt 2>/dev/null >/dev/null ); then echo yes - exit 0 else if [ $? -eq 127 ] then echo "no (netstat program not found)" - exit 1 else echo no - exit 1 fi fi + exit 0 fi if [ "$1" = "config" ]; then diff --git a/plugins/thin/thin_memory b/plugins/thin/thin_memory index f4313166..0c5aa89d 100755 --- a/plugins/thin/thin_memory +++ b/plugins/thin/thin_memory @@ -94,7 +94,7 @@ when "autoconf" exit 0 end puts "no" - exit 1 + exit 0 else mpm.run end diff --git a/plugins/thin/thin_threads b/plugins/thin/thin_threads index f07c280f..055fc657 100755 --- a/plugins/thin/thin_threads +++ b/plugins/thin/thin_threads @@ -98,7 +98,7 @@ when "autoconf" exit 0 end puts "no" - exit 1 + exit 0 else mpm.run end diff --git a/plugins/thin/thins_peak_memory b/plugins/thin/thins_peak_memory index 762013d1..bdc0a40f 100755 --- a/plugins/thin/thins_peak_memory +++ b/plugins/thin/thins_peak_memory @@ -96,7 +96,7 @@ when "autoconf" exit 0 end puts "no" - exit 1 + exit 0 else mpm.run end diff --git a/plugins/tor/tor-bandwidth-usage b/plugins/tor/tor-bandwidth-usage index 4c78378a..5c95acf3 100755 --- a/plugins/tor/tor-bandwidth-usage +++ b/plugins/tor/tor-bandwidth-usage @@ -87,7 +87,7 @@ if ($ARGV[0] and $ARGV[0] eq "autoconf") { if ($failed) { say "no (failed to connect to $address port $port)"; - exit 1; + exit 0; } my $msg = Authenticate($socket); @@ -95,7 +95,7 @@ if ($ARGV[0] and $ARGV[0] eq "autoconf") { say $socket "QUIT"; close($socket); say "no ($msg)"; - exit 1; + exit 0; } say $socket "QUIT"; diff --git a/plugins/tor/tor_routers b/plugins/tor/tor_routers index 4709bfd4..96c83908 100755 --- a/plugins/tor/tor_routers +++ b/plugins/tor/tor_routers @@ -78,7 +78,7 @@ if ($ARGV[0] and $ARGV[0] eq "autoconf") { if ($failed) { print "no (failed to connect to $address port $port)\n"; - exit 1; + exit 0; } my $msg = Authenticate($socket); @@ -86,7 +86,7 @@ if ($ARGV[0] and $ARGV[0] eq "autoconf") { print $socket "QUIT\r\n"; close($socket); print "no ($msg)\n"; - exit 1; + exit 0; } print $socket "QUIT\r\n"; diff --git a/plugins/ultramonkey/ultramonkey-l7 b/plugins/ultramonkey/ultramonkey-l7 index 22878f9e..8778bf0f 100755 --- a/plugins/ultramonkey/ultramonkey-l7 +++ b/plugins/ultramonkey/ultramonkey-l7 @@ -24,10 +24,9 @@ sub get_autoconf `$L7VSADM`; if ( $? ) { print qq{no ($L7VSADM something wrong ...)\n}; - exit 1; + } else { + print qq{yes\n}; } - - print qq{yes\n}; } diff --git a/plugins/uucp/uustat b/plugins/uucp/uustat index 76bd6de7..638a3611 100755 --- a/plugins/uucp/uustat +++ b/plugins/uucp/uustat @@ -79,11 +79,10 @@ sub host_excluded if (@ARGV > 0 && $ARGV[0] eq 'autoconf') { if (-x $uustat) { print "yes\n"; - exit 0; } else { print "no\n"; - exit 1; } + exit 0; } if (@ARGV > 0 && $ARGV[0] eq 'config') { diff --git a/plugins/vpn/openvpn_multi b/plugins/vpn/openvpn_multi index bafcc230..2ddbcc82 100755 --- a/plugins/vpn/openvpn_multi +++ b/plugins/vpn/openvpn_multi @@ -83,11 +83,10 @@ sub config { sub autoconf { if (-e $statusfile) { print "yes\n"; - exit 0; } else { print "no\n"; - exit 1; } + exit 0; } sub report { diff --git a/plugins/weather/humidity-sensor b/plugins/weather/humidity-sensor index 3c96b8f7..40d6b8e5 100755 --- a/plugins/weather/humidity-sensor +++ b/plugins/weather/humidity-sensor @@ -29,11 +29,10 @@ if (! eval "require LWP::UserAgent;") if (defined $ARGV[0] and $ARGV[0] eq "autoconf") { if (defined $ret) { print "no ($ret)\n"; - exit 1; } else { print "yes\n"; - exit 0; } + exit 0; } my $datasource = "http://weather.noaa.gov/pub/data/observations/metar/decoded/"; diff --git a/plugins/weather/temperature_ b/plugins/weather/temperature_ index e81e6740..174ef6a0 100755 --- a/plugins/weather/temperature_ +++ b/plugins/weather/temperature_ @@ -28,11 +28,10 @@ if (! eval "require LWP::UserAgent;") { if (defined $ARGV[0] and $ARGV[0] eq "autoconf") { if (defined $ret) { print "no ($ret)\n"; - exit 1; } else { print "yes\n"; - exit 0; } + exit 0; } # Extract weather-code from filename. Example: weather_CODE diff --git a/plugins/weather/temperatures b/plugins/weather/temperatures index a19cbdf4..ae550bd0 100755 --- a/plugins/weather/temperatures +++ b/plugins/weather/temperatures @@ -36,11 +36,10 @@ if (! eval "require LWP::UserAgent;") if (defined $ARGV[0] and $ARGV[0] eq "autoconf") { if (defined $ret) { print "no ($ret)\n"; - exit 1; } else { print "yes\n"; - exit 0; } + exit 0; } my $datasource = "http://tgftp.nws.noaa.gov/data/observations/metar/decoded/"; diff --git a/plugins/xbnbt/xbnbt_peers b/plugins/xbnbt/xbnbt_peers index 34d559ac..346cb2ec 100755 --- a/plugins/xbnbt/xbnbt_peers +++ b/plugins/xbnbt/xbnbt_peers @@ -75,14 +75,12 @@ if ($response->content =~ /xpeerstats.*?odd">(\d*).*?even">(\d*).*?odd">(\d*).*? if ( defined $ARGV[0] and $ARGV[0] eq "autoconf") { if (! $response->is_success) { print 'no (Error: ', $response->header('WWW-Authenticate') || ' Error accessing', $response->status_line, ' at http://'.$host.':'.$port.'/xstats.html Aborting)'; - exit 1; } elsif (! defined $peers ) { print "no (Unable to find peer values within the page from the given URL.)"; - exit 1; } else { print "yes"; - exit 0; } + exit 0; } diff --git a/plugins/xen/xen b/plugins/xen/xen index e4f9abec..cad9b7a9 100755 --- a/plugins/xen/xen +++ b/plugins/xen/xen @@ -20,10 +20,10 @@ statefile="$MUNIN_PLUGSTATE/munin-plugin-xen.state" if [ "$1" = "autoconf" ]; then if which xm > /dev/null ; then echo yes - exit 0 + else + echo "no (xm not found)" fi - echo "no (xm not found)" - exit 1 + exit 0 fi if [ "$1" = "config" ]; then diff --git a/plugins/xen/xen-cpu b/plugins/xen/xen-cpu index 4c558134..76cdca29 100755 --- a/plugins/xen/xen-cpu +++ b/plugins/xen/xen-cpu @@ -40,11 +40,10 @@ if (defined($ARGV[0])) { if ( "$arg" eq 'autoconf') { if ( -e $XM && -e $XMTOP ) { print "yes\n"; - exit 0; } else { print "no ($XM and/or $XMTOP not found\n"; - exit 1; } + exit 0; } if ( "$arg" eq 'config') { diff --git a/plugins/xen/xen_cpu_v2 b/plugins/xen/xen_cpu_v2 index 4483cf96..06a4a2fc 100755 --- a/plugins/xen/xen_cpu_v2 +++ b/plugins/xen/xen_cpu_v2 @@ -56,13 +56,12 @@ if ( defined($ARGV[0]) ) if ( -e $XM && -e $XMTOP ) { print "yes\n"; - exit 0; } else { print "no ($XM and/or $XMTOP not found\n"; - exit 1; } + exit 0; } if ( $arg eq 'config' ) diff --git a/plugins/yum/yum_activity b/plugins/yum/yum_activity index 5b02ea9b..e41500f9 100755 --- a/plugins/yum/yum_activity +++ b/plugins/yum/yum_activity @@ -12,11 +12,10 @@ if [ "$1" = "autoconf" ]; then if [ -r /var/log/yum.log ]; then echo yes - exit 0 else echo "no (/var/log/yum.log not readable)" - exit 1 fi + exit 0 fi if [ "$1" = "config" ]; then diff --git a/plugins/zfs/zfsarcstats-counters b/plugins/zfs/zfsarcstats-counters index 594b3d31..04106875 100755 --- a/plugins/zfs/zfsarcstats-counters +++ b/plugins/zfs/zfsarcstats-counters @@ -23,15 +23,15 @@ $sysctl kstat.zfs.misc.arcstats.hits kstat.zfs.misc.arcstats | awk '/hits/ || /m autoconf) if [ ! -x ${sysctl} ]; then echo "no (${sysctl} is not executable)" - exit 1 + exit 0 fi ostype=`uname -s` if [ ${ostype} = "FreeBSD" ]; then echo "yes" - exit 0 + 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 From 2ec4e4c1f7050ba03dfe5e9edc150f43863e1dbc Mon Sep 17 00:00:00 2001 From: Lars Kruse Date: Sun, 16 Sep 2018 04:09:21 +0200 Subject: [PATCH 2/4] Improve incorrect or unspecific output for "autoconf" Some plugins emit wrongly formatted "no" messages or lack the "yes" message on success. --- plugins/amule/amule_queue | 7 +++---- plugins/amule/amule_shares | 7 +++---- plugins/amule/amule_transfers | 7 +++---- plugins/amule/amule_uptime | 7 +++---- plugins/bind/bind95_ | 8 ++++---- plugins/disk/lvm_snap_used | 6 +++--- plugins/disk/raid | 5 ++--- plugins/disk/xfs | 5 ++--- plugins/http/wget_page | 32 ++++++++++-------------------- plugins/mysql/mysql_report | 5 ++--- plugins/mythtv/mythtv_programs | 6 ++---- plugins/other/listeners | 2 +- plugins/php/php_errors_ | 6 +++--- plugins/punbb/punbb_users | 7 ++++--- plugins/snmp/snmp__fn | 26 ++++++++---------------- plugins/solaris/zones_cpu | 5 ++--- plugins/solaris/zones_mem | 5 ++--- plugins/vbulletin/vbulletin4_users | 8 ++++---- plugins/vbulletin/vbulletin_users | 8 ++++---- plugins/vmware/esxi | 5 ++--- 20 files changed, 68 insertions(+), 99 deletions(-) diff --git a/plugins/amule/amule_queue b/plugins/amule/amule_queue index 53f5afd0..e73d37b0 100755 --- a/plugins/amule/amule_queue +++ b/plugins/amule/amule_queue @@ -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 diff --git a/plugins/amule/amule_shares b/plugins/amule/amule_shares index 33789a36..c0129e35 100755 --- a/plugins/amule/amule_shares +++ b/plugins/amule/amule_shares @@ -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 diff --git a/plugins/amule/amule_transfers b/plugins/amule/amule_transfers index 2591c344..79623d66 100755 --- a/plugins/amule/amule_transfers +++ b/plugins/amule/amule_transfers @@ -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 diff --git a/plugins/amule/amule_uptime b/plugins/amule/amule_uptime index fbf34e39..c58114d8 100755 --- a/plugins/amule/amule_uptime +++ b/plugins/amule/amule_uptime @@ -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 diff --git a/plugins/bind/bind95_ b/plugins/bind/bind95_ index bf42fe81..edad0815 100755 --- a/plugins/bind/bind95_ +++ b/plugins/bind/bind95_ @@ -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; } diff --git a/plugins/disk/lvm_snap_used b/plugins/disk/lvm_snap_used index aabbe460..4be838a7 100755 --- a/plugins/disk/lvm_snap_used +++ b/plugins/disk/lvm_snap_used @@ -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 diff --git a/plugins/disk/raid b/plugins/disk/raid index bbfc0e8a..c02a1689 100755 --- a/plugins/disk/raid +++ b/plugins/disk/raid @@ -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" ) { diff --git a/plugins/disk/xfs b/plugins/disk/xfs index 8a06a555..55919038 100755 --- a/plugins/disk/xfs +++ b/plugins/disk/xfs @@ -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 = ( diff --git a/plugins/http/wget_page b/plugins/http/wget_page index 00081281..c137ff96 100755 --- a/plugins/http/wget_page +++ b/plugins/http/wget_page @@ -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 diff --git a/plugins/mysql/mysql_report b/plugins/mysql/mysql_report index 06df41f6..a680df38 100755 --- a/plugins/mysql/mysql_report +++ b/plugins/mysql/mysql_report @@ -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 diff --git a/plugins/mythtv/mythtv_programs b/plugins/mythtv/mythtv_programs index e205329b..4abcf559 100755 --- a/plugins/mythtv/mythtv_programs +++ b/plugins/mythtv/mythtv_programs @@ -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 diff --git a/plugins/other/listeners b/plugins/other/listeners index 8f426d36..235bcb08 100755 --- a/plugins/other/listeners +++ b/plugins/other/listeners @@ -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 diff --git a/plugins/php/php_errors_ b/plugins/php/php_errors_ index fd4f43fe..d02f8064 100755 --- a/plugins/php/php_errors_ +++ b/plugins/php/php_errors_ @@ -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 diff --git a/plugins/punbb/punbb_users b/plugins/punbb/punbb_users index 453fc923..954233d9 100755 --- a/plugins/punbb/punbb_users +++ b/plugins/punbb/punbb_users @@ -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; } diff --git a/plugins/snmp/snmp__fn b/plugins/snmp/snmp__fn index 521b19a9..051408b1 100755 --- a/plugins/snmp/snmp__fn +++ b/plugins/snmp/snmp__fn @@ -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() diff --git a/plugins/solaris/zones_cpu b/plugins/solaris/zones_cpu index 003d6d1a..5fb58f45 100755 --- a/plugins/solaris/zones_cpu +++ b/plugins/solaris/zones_cpu @@ -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 diff --git a/plugins/solaris/zones_mem b/plugins/solaris/zones_mem index d492af05..a25cb830 100755 --- a/plugins/solaris/zones_mem +++ b/plugins/solaris/zones_mem @@ -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 diff --git a/plugins/vbulletin/vbulletin4_users b/plugins/vbulletin/vbulletin4_users index ead4ebb8..b8ea1c12 100755 --- a/plugins/vbulletin/vbulletin4_users +++ b/plugins/vbulletin/vbulletin4_users @@ -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" ) diff --git a/plugins/vbulletin/vbulletin_users b/plugins/vbulletin/vbulletin_users index 663eb3d0..27dd837d 100755 --- a/plugins/vbulletin/vbulletin_users +++ b/plugins/vbulletin/vbulletin_users @@ -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" ) diff --git a/plugins/vmware/esxi b/plugins/vmware/esxi index 00c5b982..0c2894a6 100755 --- a/plugins/vmware/esxi +++ b/plugins/vmware/esxi @@ -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 From 46e2de55def5c1a660f7ebbec9f22bbb5a8f8cf2 Mon Sep 17 00:00:00 2001 From: Lars Kruse Date: Sun, 16 Sep 2018 04:23:14 +0200 Subject: [PATCH 3/4] Remove unused "autoconf" handling from plugins without this capability Some plugins contained code for handling "autoconf" (always returning "no") but did not announce the respective capability via the magic marker. --- plugins/router/snmp__linksys_poe | 3 --- plugins/rtorrent/rtom_allsessions_mem | 4 ---- plugins/rtorrent/rtom_allsessions_peers | 4 ---- plugins/rtorrent/rtom_allsessions_spdd | 4 ---- plugins/rtorrent/rtom_allsessions_vol | 4 ---- plugins/rtorrent/rtom_mem | 4 ---- plugins/rtorrent/rtom_peers | 4 ---- plugins/rtorrent/rtom_spdd | 4 ---- plugins/rtorrent/rtom_vol | 4 ---- plugins/wuala/wuala_stats | 7 ++----- 10 files changed, 2 insertions(+), 40 deletions(-) diff --git a/plugins/router/snmp__linksys_poe b/plugins/router/snmp__linksys_poe index 0e5c9a4d..a79a27ea 100755 --- a/plugins/router/snmp__linksys_poe +++ b/plugins/router/snmp__linksys_poe @@ -73,9 +73,6 @@ community = ENV['community'] || "public" version = ENV['version'] == '1' ? :SNMPv1 : :SNMPv2c case ARGV[0] -when "autoconf" - puts "no" - exit 1 when "snmpconf" puts "require 1.3.6.1.4.1.3955.89.108.1.1.2.1. [0-9]" puts "require 1.3.6.1.4.1.3955.89.108.1.1.5.1. [0-9]" diff --git a/plugins/rtorrent/rtom_allsessions_mem b/plugins/rtorrent/rtom_allsessions_mem index 565eea90..82c6dcd4 100755 --- a/plugins/rtorrent/rtom_allsessions_mem +++ b/plugins/rtorrent/rtom_allsessions_mem @@ -46,10 +46,6 @@ #%# family=auto -if ( $ARGV[0] and $ARGV[0] eq "autoconf" ) { - exit 1; -} - if ( $ARGV[0] and $ARGV[0] eq "config" ) { my $category = $ENV{"category"} || ""; print "graph_title rTorrent memory usage\n"; diff --git a/plugins/rtorrent/rtom_allsessions_peers b/plugins/rtorrent/rtom_allsessions_peers index f452677c..93a06a38 100755 --- a/plugins/rtorrent/rtom_allsessions_peers +++ b/plugins/rtorrent/rtom_allsessions_peers @@ -44,10 +44,6 @@ #%# family=auto -if ( $ARGV[0] and $ARGV[0] eq "autoconf" ) { - exit 1; -} - if ( $ARGV[0] and $ARGV[0] eq "config" ) { my $category = $ENV{"category"} || ""; print "graph_title rTorrent peer statistics\n"; diff --git a/plugins/rtorrent/rtom_allsessions_spdd b/plugins/rtorrent/rtom_allsessions_spdd index a9ce779b..cf893cb5 100755 --- a/plugins/rtorrent/rtom_allsessions_spdd +++ b/plugins/rtorrent/rtom_allsessions_spdd @@ -56,10 +56,6 @@ #%# family=auto -if ( $ARGV[0] and $ARGV[0] eq "autoconf" ) { - exit 1; -} - if ( $ARGV[0] and $ARGV[0] eq "config" ) { my $diff = $ENV{"diff"} || ""; my $category = $ENV{"category"} || ""; diff --git a/plugins/rtorrent/rtom_allsessions_vol b/plugins/rtorrent/rtom_allsessions_vol index 97818291..ed483e66 100755 --- a/plugins/rtorrent/rtom_allsessions_vol +++ b/plugins/rtorrent/rtom_allsessions_vol @@ -46,10 +46,6 @@ my @views = ( "default", "started", "stopped", "complete", "incomplete" ); -if ( $ARGV[0] and $ARGV[0] eq "autoconf" ) { - exit 1; -} - if ( $ARGV[0] and $ARGV[0] eq "config" ) { my $category = $ENV{"category"} || ""; print "graph_args --base 1000 -r --lower-limit 0\n"; diff --git a/plugins/rtorrent/rtom_mem b/plugins/rtorrent/rtom_mem index afb00cef..f691aab1 100755 --- a/plugins/rtorrent/rtom_mem +++ b/plugins/rtorrent/rtom_mem @@ -44,10 +44,6 @@ #%# family=auto -if ( $ARGV[0] and $ARGV[0] eq "autoconf" ) { - exit 1; -} - if ( $ARGV[0] and $ARGV[0] eq "config" ) { my $category = $ENV{"category"} || ""; print "graph_title rTorrent memory usage\n"; diff --git a/plugins/rtorrent/rtom_peers b/plugins/rtorrent/rtom_peers index dace07bb..ae414542 100755 --- a/plugins/rtorrent/rtom_peers +++ b/plugins/rtorrent/rtom_peers @@ -44,10 +44,6 @@ #%# family=auto -if ( $ARGV[0] and $ARGV[0] eq "autoconf" ) { - exit 1; -} - if ( $ARGV[0] and $ARGV[0] eq "config" ) { my $category = $ENV{"category"} || ""; print "graph_title rTorrent peer statistics\n"; diff --git a/plugins/rtorrent/rtom_spdd b/plugins/rtorrent/rtom_spdd index cbb06c14..e2b08835 100755 --- a/plugins/rtorrent/rtom_spdd +++ b/plugins/rtorrent/rtom_spdd @@ -57,10 +57,6 @@ #%# family=auto -if ( $ARGV[0] and $ARGV[0] eq "autoconf" ) { - exit 1; -} - if ( $ARGV[0] and $ARGV[0] eq "config" ) { my $diff = $ENV{"diff"} || ""; my $category = $ENV{"category"} || ""; diff --git a/plugins/rtorrent/rtom_vol b/plugins/rtorrent/rtom_vol index f8e08e33..ea88fe13 100755 --- a/plugins/rtorrent/rtom_vol +++ b/plugins/rtorrent/rtom_vol @@ -45,10 +45,6 @@ my @views = ( "default", "started", "stopped", "complete", "incomplete" ); -if ( $ARGV[0] and $ARGV[0] eq "autoconf" ) { - exit 1; -} - if ( $ARGV[0] and $ARGV[0] eq "config" ) { my $category = $ENV{"category"} || ""; print "graph_args --base 1000 -r --lower-limit 0\n"; diff --git a/plugins/wuala/wuala_stats b/plugins/wuala/wuala_stats index f151b737..57ec557b 100755 --- a/plugins/wuala/wuala_stats +++ b/plugins/wuala/wuala_stats @@ -33,11 +33,8 @@ # my $wualadir = $ENV{wualadir}; -if ($ARGV[0] and $ARGV[0] eq "autoconf") -{ - print "no\n"; - exit 1; -} elsif ($ARGV[0] and $ARGV[0] eq "config") + +if ($ARGV[0] and $ARGV[0] eq "config") { if($0 =~ /.*_uptime/) { print "graph_args -l0 --vertical-label %\n"; From 9cef55a3edb9c8129752117ba46cd95d8d90118f Mon Sep 17 00:00:00 2001 From: Lars Kruse Date: Sun, 16 Sep 2018 05:03:47 +0200 Subject: [PATCH 4/4] 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. --- plugins/arp/arp | 9 +++++---- plugins/arp/arp_ | 10 ++++------ plugins/backuppc/backuppc | 9 ++++++--- plugins/google/google-rank | 12 +++++------- plugins/jvm/jstat__gccount | 14 ++++++-------- plugins/jvm/jstat__gctime | 14 ++++++-------- plugins/jvm/jstat__heap | 14 ++++++-------- plugins/memory/kmemsum | 17 +++++++---------- plugins/mpd/mpdstats_ | 10 +++------- plugins/mythtv/dvb-signal | 14 +++++--------- plugins/network/brc_rssi | 8 ++++---- plugins/php/php_apc_ | 8 ++++++-- plugins/php/php_opcache | 8 ++++++-- plugins/wifi/wifi_signal | 25 +++++++++---------------- plugins/zfs/zfs_cache_efficiency | 18 +++++++----------- 15 files changed, 85 insertions(+), 105 deletions(-) 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