From d6baf9dbce1578ca59a577ac8155b835c46f0a16 Mon Sep 17 00:00:00 2001 From: Sven Nierlein Date: Sun, 4 Oct 2015 18:48:23 +0200 Subject: change exit code to unknown on help and version info Signed-off-by: Sven Nierlein --- 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 12a60ee6..05b99203 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 99948a41..98992268 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 15330f71..56b8e97c 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 49d674d4..e3fe296f 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 1a7fbba4..3eed4bcb 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 2c76d0c8..9f2f7c31 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 afedfb95..22d21c2e 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 3086e94a..32f498d3 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 a436a8ff..fb3952d4 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 af1456be..fd418734 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 dd2cd6dc..f4000019 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 cbdeceb4..47d6e49e 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 979416e0..41e15f50 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 be8ae2f7..c58f7bf7 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); -- cgit v1.2.3-74-g34f1