[monitoring-plugins] change exit code to unknown on help and version ...

Sven Nierlein git at monitoring-plugins.org
Sun Oct 4 23:50:10 CEST 2015


 Module: monitoring-plugins
 Branch: master
 Commit: d6baf9dbce1578ca59a577ac8155b835c46f0a16
 Author: Sven Nierlein <sven at nierlein.de>
   Date: Sun Oct  4 18:48:23 2015 +0200
    URL: https://www.monitoring-plugins.org/repositories/monitoring-plugins/commit/?id=d6baf9d

change exit code to unknown on help and version info

Signed-off-by: Sven Nierlein <sven at nierlein.de>

---

 plugins-scripts/check_breeze.pl       | 4 ++--
 plugins-scripts/check_disk_smb.pl     | 4 ++--
 plugins-scripts/check_file_age.pl     | 4 ++--
 plugins-scripts/check_flexlm.pl       | 4 ++--
 plugins-scripts/check_ifoperstatus.pl | 6 +++---
 plugins-scripts/check_ifstatus.pl     | 8 ++++----
 plugins-scripts/check_ircd.pl         | 4 ++--
 plugins-scripts/check_mailq.pl        | 4 ++--
 plugins-scripts/check_mssql.pl        | 2 +-
 plugins-scripts/check_netdns.pl       | 6 +++---
 plugins-scripts/check_ntp.pl          | 4 ++--
 plugins-scripts/check_rpc.pl          | 4 ++--
 plugins-scripts/check_wave.pl         | 4 ++--
 plugins-scripts/t/check_rpc.t         | 2 +-
 14 files changed, 30 insertions(+), 30 deletions(-)

diff --git a/plugins-scripts/check_breeze.pl b/plugins-scripts/check_breeze.pl
index 12a60ee..05b9920 100755
--- a/plugins-scripts/check_breeze.pl
+++ b/plugins-scripts/check_breeze.pl
@@ -28,10 +28,10 @@ GetOptions
 
 if ($opt_V) {
 	print_revision($PROGNAME,'@NP_VERSION@');
-	exit $ERRORS{'OK'};
+	exit $ERRORS{'UNKNOWN'};
 }
 
-if ($opt_h) {print_help(); exit $ERRORS{'OK'};}
+if ($opt_h) {print_help(); exit $ERRORS{'UNKNOWN'};}
 
 ($opt_H) || usage("Host name/address not specified\n");
 my $host = $1 if ($opt_H =~ /([-.A-Za-z0-9]+)/);
diff --git a/plugins-scripts/check_disk_smb.pl b/plugins-scripts/check_disk_smb.pl
index 99948a4..9899226 100755
--- a/plugins-scripts/check_disk_smb.pl
+++ b/plugins-scripts/check_disk_smb.pl
@@ -54,10 +54,10 @@ GetOptions
 
 if ($opt_V) {
 	print_revision($PROGNAME,'@NP_VERSION@'); #'
-	exit $ERRORS{'OK'};
+	exit $ERRORS{'UNKNOWN'};
 }
 
-if ($opt_h) {print_help(); exit $ERRORS{'OK'};}
+if ($opt_h) {print_help(); exit $ERRORS{'UNKNOWN'};}
 
 my $smbclient = $utils::PATH_TO_SMBCLIENT;
 $smbclient    || usage("check requires smbclient, smbclient not set\n");
diff --git a/plugins-scripts/check_file_age.pl b/plugins-scripts/check_file_age.pl
index 15330f7..56b8e97 100755
--- a/plugins-scripts/check_file_age.pl
+++ b/plugins-scripts/check_file_age.pl
@@ -60,12 +60,12 @@ GetOptions(
 
 if ($opt_V) {
 	print_revision($PROGNAME, '@NP_VERSION@');
-	exit $ERRORS{'OK'};
+	exit $ERRORS{'UNKNOWN'};
 }
 
 if ($opt_h) {
 	print_help();
-	exit $ERRORS{'OK'};
+	exit $ERRORS{'UNKNOWN'};
 }
 
 $opt_f = shift unless ($opt_f);
diff --git a/plugins-scripts/check_flexlm.pl b/plugins-scripts/check_flexlm.pl
index 49d674d..e3fe296 100755
--- a/plugins-scripts/check_flexlm.pl
+++ b/plugins-scripts/check_flexlm.pl
@@ -58,7 +58,7 @@ GetOptions
 
 if ($opt_V) {
 	print_revision($PROGNAME,'@NP_VERSION@');
-	exit $ERRORS{'OK'};
+	exit $ERRORS{'UNKNOWN'};
 }
 
 unless (defined $opt_t) {
@@ -66,7 +66,7 @@ unless (defined $opt_t) {
 }
 
 
-if ($opt_h) {print_help(); exit $ERRORS{'OK'};}
+if ($opt_h) {print_help(); exit $ERRORS{'UNKNOWN'};}
 
 unless (defined $opt_F) {
 	print "Missing license.dat file\n";
diff --git a/plugins-scripts/check_ifoperstatus.pl b/plugins-scripts/check_ifoperstatus.pl
index 1a7fbba..3eed4bc 100755
--- a/plugins-scripts/check_ifoperstatus.pl
+++ b/plugins-scripts/check_ifoperstatus.pl
@@ -367,17 +367,17 @@ sub process_arguments() {
 
 	if ($status == 0){
 		print_help();
-		exit $ERRORS{'OK'};
+		exit $ERRORS{'UNKNOWN'};
 	}
 
 	if ($opt_V) {
 		print_revision($PROGNAME,'@NP_VERSION@');
-		exit $ERRORS{'OK'};
+		exit $ERRORS{'UNKNOWN'};
 	}
 
 	if ($opt_h) {
 		print_help();
-		exit $ERRORS{'OK'};
+		exit $ERRORS{'UNKNOWN'};
 	}
 
 	if (! utils::is_hostname($hostname)){
diff --git a/plugins-scripts/check_ifstatus.pl b/plugins-scripts/check_ifstatus.pl
index 2c76d0c..9f2f7c3 100755
--- a/plugins-scripts/check_ifstatus.pl
+++ b/plugins-scripts/check_ifstatus.pl
@@ -119,7 +119,7 @@ $status = process_arguments();
 if ($status != 0)
 {
 	print_help() ;
-	exit $ERRORS{'OK'};
+	exit $ERRORS{'UNKNOWN'};
 }
 
 
@@ -313,17 +313,17 @@ sub process_arguments() {
 		
 	if ($status == 0){
 		print_help();
-		exit $ERRORS{'OK'};
+		exit $ERRORS{'UNKNOWN'};
 	}
 
 	if ($opt_V) {
 		print_revision($PROGNAME,'@NP_VERSION@');
-		exit $ERRORS{'OK'};
+		exit $ERRORS{'UNKNOWN'};
 	}
 
 	if ($opt_h) {
 		print_help();
-		exit $ERRORS{'OK'};
+		exit $ERRORS{'UNKNOWN'};
 	}
 
 	unless (defined $timeout) {
diff --git a/plugins-scripts/check_ircd.pl b/plugins-scripts/check_ircd.pl
index afedfb9..22d21c2 100755
--- a/plugins-scripts/check_ircd.pl
+++ b/plugins-scripts/check_ircd.pl
@@ -181,10 +181,10 @@ MAIN:
 
 	if ($opt_V) {
 		print_revision($PROGNAME,'@NP_VERSION@');
-		exit $ERRORS{'OK'};
+		exit $ERRORS{'UNKNOWN'};
 	}
 
-	if ($opt_h) {print_help(); exit $ERRORS{'OK'};}
+	if ($opt_h) {print_help(); exit $ERRORS{'UNKNOWN'};}
 
 	($opt_H) || ($opt_H = shift @ARGV) || usage("Host name/address not specified\n");
 	my $remotehost = $1 if ($opt_H =~ /([-.A-Za-z0-9]+)/);
diff --git a/plugins-scripts/check_mailq.pl b/plugins-scripts/check_mailq.pl
index 3086e94..32f498d 100755
--- a/plugins-scripts/check_mailq.pl
+++ b/plugins-scripts/check_mailq.pl
@@ -573,12 +573,12 @@ sub process_arguments(){
 
 	if ($opt_V) {
 		print_revision($PROGNAME,'@NP_VERSION@');
-		exit $ERRORS{'OK'};
+		exit $ERRORS{'UNKNOWN'};
 	}
 
 	if ($opt_h) {
 		print_help();
-		exit $ERRORS{'OK'};
+		exit $ERRORS{'UNKNOWN'};
 	}
 
 	if (defined $opt_v ){
diff --git a/plugins-scripts/check_mssql.pl b/plugins-scripts/check_mssql.pl
index a436a8f..fb3952d 100755
--- a/plugins-scripts/check_mssql.pl
+++ b/plugins-scripts/check_mssql.pl
@@ -130,7 +130,7 @@ sub process_arguments {
 
 	if (defined $opt_V) {
 		print_revision($PROGNAME,'@NP_VERSION@');
-		exit $ERRORS{'OK'};
+		exit $ERRORS{'UNKNOWN'};
 	}
 
 	syntax("Help:") if ($help);
diff --git a/plugins-scripts/check_netdns.pl b/plugins-scripts/check_netdns.pl
index af1456b..fd41873 100755
--- a/plugins-scripts/check_netdns.pl
+++ b/plugins-scripts/check_netdns.pl
@@ -45,10 +45,10 @@ GetOptions("V" => $opt_V,         "version" => $opt_V,
 					 "H=s" => $opt_H,       "hostname=s" => $opt_H);
                            
 # -h means display verbose help screen
-if($opt_h){ print_help(); exit 0; }
+if($opt_h){ print_help(); exit 3; }
 
 # -V means display version number
-if ($opt_V) { print_version(); exit 0; }
+if ($opt_V) { print_version(); exit 3; }
 
 # -H means host name
 $opt_H = shift unless ($opt_H);
@@ -70,7 +70,7 @@ if ($opt_s) {
 		$server = $1;
 	} else {
 		print "$opt_s is not a valid host name";
-		exit -1;
+		exit 3;
 	}
 }
 
diff --git a/plugins-scripts/check_ntp.pl b/plugins-scripts/check_ntp.pl
index dd2cd6d..f400001 100755
--- a/plugins-scripts/check_ntp.pl
+++ b/plugins-scripts/check_ntp.pl
@@ -98,12 +98,12 @@ GetOptions
 
 if ($opt_V) {
 	print_revision($PROGNAME,'@NP_VERSION@');
-	exit $ERRORS{'OK'};
+	exit $ERRORS{'UNKNOWN'};
 }
 
 if ($opt_h) {
 	print_help();
-	exit $ERRORS{'OK'};
+	exit $ERRORS{'UNKNOWN'};
 }
 
 # jitter test params specified
diff --git a/plugins-scripts/check_rpc.pl b/plugins-scripts/check_rpc.pl
index cbdeceb..47d6e49 100755
--- a/plugins-scripts/check_rpc.pl
+++ b/plugins-scripts/check_rpc.pl
@@ -63,12 +63,12 @@ GetOptions(
 );
 
 # -h means display verbose help screen
-if ($opt_h) { print_help(); exit $ERRORS{'OK'}; }
+if ($opt_h) { print_help(); exit $ERRORS{'UNKNOWN'}; }
 
 # -V means display version number
 if ($opt_V) {
 	print_revision($PROGNAME,'@NP_VERSION@');
-	exit $ERRORS{'OK'};
+	exit $ERRORS{'UNKNOWN'};
 }
 
 # Hash containing all RPC program names and numbers
diff --git a/plugins-scripts/check_wave.pl b/plugins-scripts/check_wave.pl
index 979416e..41e15f5 100755
--- a/plugins-scripts/check_wave.pl
+++ b/plugins-scripts/check_wave.pl
@@ -31,12 +31,12 @@ GetOptions
 
 if ($opt_V) {
 	print_revision($PROGNAME,'@NP_VERSION@'); #'
-	exit $ERRORS{'OK'};
+	exit $ERRORS{'UNKNOWN'};
 }
 
 if ($opt_h) {
 	print_help();
-	exit $ERRORS{'OK'};
+	exit $ERRORS{'UNKNOWN'};
 }
 
 $opt_H = shift unless ($opt_H);
diff --git a/plugins-scripts/t/check_rpc.t b/plugins-scripts/t/check_rpc.t
index be8ae2f..c58f7bf 100644
--- a/plugins-scripts/t/check_rpc.t
+++ b/plugins-scripts/t/check_rpc.t
@@ -15,7 +15,7 @@ my $successOutput = '/^check_rpc/';
 
 my $t;
 
-$t += checkCmd( "./check_rpc -V",   0, $successOutput );
+$t += checkCmd( "./check_rpc -V",   3, $successOutput );
 
 exit(0) if defined($Test::Harness::VERSION);
 exit($tests - $t);



More information about the Commits mailing list