Kaynağa Gözat

change exit code to unknown on help and version info

Signed-off-by: Sven Nierlein <sven@nierlein.de>
Sven Nierlein 10 yıl önce
ebeveyn
işleme
d6baf9dbce

+ 2 - 2
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]+)/);

+ 2 - 2
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");

+ 2 - 2
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);

+ 2 - 2
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";

+ 3 - 3
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)){

+ 4 - 4
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) {

+ 2 - 2
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]+)/);

+ 2 - 2
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 ){

+ 1 - 1
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);

+ 3 - 3
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;
 	}
 }
 

+ 2 - 2
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

+ 2 - 2
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

+ 2 - 2
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);

+ 1 - 1
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);