From 741710c27c1749b81be4260a2ce0c18b319623cd Mon Sep 17 00:00:00 2001 From: Sven Nierlein Date: Sun, 4 Oct 2015 18:35:26 +0200 Subject: use exit code 3 for version and help Plugins which use OK state for help or version information may run unnoticed in that modes without doing any check. So its good style to let version and help exit with Unknown state. Signed-off-by: Sven Nierlein --- doc/developer-guidelines.sgml | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/doc/developer-guidelines.sgml b/doc/developer-guidelines.sgml index d9340285..228d3fa1 100644 --- a/doc/developer-guidelines.sgml +++ b/doc/developer-guidelines.sgml @@ -194,13 +194,15 @@ 3 Unknown - Invalid command line arguments were supplied to the + Invalid command line arguments were supplied to the plugin or low-level failures internal to the plugin (such as unable to fork, or open a tcp socket) that prevent it from performing the specified operation. Higher-level errors (such as name resolution errors, socket timeouts, etc) are outside of the control of plugins and should generally NOT be reported as UNKNOWN states. - + + The --help or --version output should also result in Unknown state. + @@ -610,6 +612,9 @@ The option -v or --verbose should be present in all plugins. The user should be allowed to specify -v multiple times to increase the verbosity level, as described in . + + The exit code for version information or help should be UNKNOWN + (3).
-- cgit v1.2.3-74-g34f1 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 From edca257e2032866f6ca63bc540a317574cd89ac8 Mon Sep 17 00:00:00 2001 From: Sven Nierlein Date: Sun, 4 Oct 2015 19:02:43 +0200 Subject: use unknown exit code for help/version in plugins Signed-off-by: Sven Nierlein --- plugins/check_apt.c | 4 ++-- plugins/check_by_ssh.c | 4 ++-- plugins/check_cluster.c | 2 +- plugins/check_dbi.c | 4 ++-- plugins/check_dig.c | 4 ++-- plugins/check_disk.c | 4 ++-- plugins/check_dns.c | 4 ++-- plugins/check_dummy.c | 4 ++-- plugins/check_fping.c | 4 ++-- plugins/check_game.c | 4 ++-- plugins/check_hpjd.c | 4 ++-- plugins/check_http.c | 4 ++-- plugins/check_ide_smart.c | 6 +++--- plugins/check_ldap.c | 4 ++-- plugins/check_load.c | 4 ++-- plugins/check_mrtg.c | 4 ++-- plugins/check_mrtgtraf.c | 4 ++-- plugins/check_mysql.c | 4 ++-- plugins/check_mysql_query.c | 4 ++-- plugins/check_nagios.c | 4 ++-- plugins/check_nt.c | 4 ++-- plugins/check_ntp.c | 4 ++-- plugins/check_ntp_peer.c | 4 ++-- plugins/check_ntp_time.c | 4 ++-- plugins/check_nwstat.c | 4 ++-- plugins/check_overcr.c | 4 ++-- plugins/check_pgsql.c | 4 ++-- plugins/check_ping.c | 4 ++-- plugins/check_procs.c | 4 ++-- plugins/check_radius.c | 4 ++-- plugins/check_real.c | 4 ++-- plugins/check_smtp.c | 4 ++-- plugins/check_snmp.c | 4 ++-- plugins/check_ssh.c | 4 ++-- plugins/check_swap.c | 4 ++-- plugins/check_tcp.c | 4 ++-- plugins/check_time.c | 4 ++-- plugins/check_ups.c | 4 ++-- plugins/check_users.c | 4 ++-- 39 files changed, 78 insertions(+), 78 deletions(-) diff --git a/plugins/check_apt.c b/plugins/check_apt.c index 8747f904..a639a411 100644 --- a/plugins/check_apt.c +++ b/plugins/check_apt.c @@ -160,10 +160,10 @@ int process_arguments (int argc, char **argv) { switch(c) { case 'h': print_help(); - exit(STATE_OK); + exit(STATE_UNKNOWN); case 'V': print_revision(progname, NP_VERSION); - exit(STATE_OK); + exit(STATE_UNKNOWN); case 'v': verbose++; break; diff --git a/plugins/check_by_ssh.c b/plugins/check_by_ssh.c index a877f888..04bce38d 100644 --- a/plugins/check_by_ssh.c +++ b/plugins/check_by_ssh.c @@ -209,10 +209,10 @@ process_arguments (int argc, char **argv) switch (c) { case 'V': /* version */ print_revision (progname, NP_VERSION); - exit (STATE_OK); + exit (STATE_UNKNOWN); case 'h': /* help */ print_help (); - exit (STATE_OK); + exit (STATE_UNKNOWN); case 'v': /* help */ verbose = TRUE; break; diff --git a/plugins/check_cluster.c b/plugins/check_cluster.c index cf699e1f..b86e501d 100644 --- a/plugins/check_cluster.c +++ b/plugins/check_cluster.c @@ -200,7 +200,7 @@ int process_arguments(int argc, char **argv){ case 'V': /* version */ print_revision (progname, NP_VERSION); - exit (STATE_OK); + exit (STATE_UNKNOWN); break; case 'H': /* help */ diff --git a/plugins/check_dbi.c b/plugins/check_dbi.c index a3d033f4..826eb8d9 100644 --- a/plugins/check_dbi.c +++ b/plugins/check_dbi.c @@ -368,10 +368,10 @@ process_arguments (int argc, char **argv) usage5 (); case 'h': /* help */ print_help (); - exit (STATE_OK); + exit (STATE_UNKNOWN); case 'V': /* version */ print_revision (progname, NP_VERSION); - exit (STATE_OK); + exit (STATE_UNKNOWN); case 'c': /* critical range */ critical_range = optarg; diff --git a/plugins/check_dig.c b/plugins/check_dig.c index d899b119..db4b20eb 100644 --- a/plugins/check_dig.c +++ b/plugins/check_dig.c @@ -223,10 +223,10 @@ process_arguments (int argc, char **argv) switch (c) { case 'h': /* help */ print_help (); - exit (STATE_OK); + exit (STATE_UNKNOWN); case 'V': /* version */ print_revision (progname, NP_VERSION); - exit (STATE_OK); + exit (STATE_UNKNOWN); case 'H': /* hostname */ host_or_die(optarg); dns_server = optarg; diff --git a/plugins/check_disk.c b/plugins/check_disk.c index eb573f5f..9693bad3 100644 --- a/plugins/check_disk.c +++ b/plugins/check_disk.c @@ -766,10 +766,10 @@ process_arguments (int argc, char **argv) break; case 'V': /* version */ print_revision (progname, NP_VERSION); - exit (STATE_OK); + exit (STATE_UNKNOWN); case 'h': /* help */ print_help (); - exit (STATE_OK); + exit (STATE_UNKNOWN); case '?': /* help */ usage (_("Unknown argument")); } diff --git a/plugins/check_dns.c b/plugins/check_dns.c index 22121226..d6bd2c0f 100644 --- a/plugins/check_dns.c +++ b/plugins/check_dns.c @@ -395,10 +395,10 @@ process_arguments (int argc, char **argv) switch (c) { case 'h': /* help */ print_help (); - exit (STATE_OK); + exit (STATE_UNKNOWN); case 'V': /* version */ print_revision (progname, NP_VERSION); - exit (STATE_OK); + exit (STATE_UNKNOWN); case 'v': /* version */ verbose = TRUE; break; diff --git a/plugins/check_dummy.c b/plugins/check_dummy.c index 3ed68717..212a1344 100644 --- a/plugins/check_dummy.c +++ b/plugins/check_dummy.c @@ -52,11 +52,11 @@ main (int argc, char **argv) usage4 (_("Could not parse arguments")); else if (strcmp (argv[1], "-V") == 0 || strcmp (argv[1], "--version") == 0) { print_revision (progname, NP_VERSION); - exit (STATE_OK); + exit (STATE_UNKNOWN); } else if (strcmp (argv[1], "-h") == 0 || strcmp (argv[1], "--help") == 0) { print_help (); - exit (STATE_OK); + exit (STATE_UNKNOWN); } else if (!is_integer (argv[1])) usage4 (_("Arguments to check_dummy must be an integer")); diff --git a/plugins/check_fping.c b/plugins/check_fping.c index 274dd753..da1ce1a6 100644 --- a/plugins/check_fping.c +++ b/plugins/check_fping.c @@ -314,10 +314,10 @@ process_arguments (int argc, char **argv) usage5 (); case 'h': /* help */ print_help (); - exit (STATE_OK); + exit (STATE_UNKNOWN); case 'V': /* version */ print_revision (progname, NP_VERSION); - exit (STATE_OK); + exit (STATE_UNKNOWN); case 'v': /* verbose mode */ verbose = TRUE; break; diff --git a/plugins/check_game.c b/plugins/check_game.c index 29e59e2f..709dae1b 100644 --- a/plugins/check_game.c +++ b/plugins/check_game.c @@ -196,10 +196,10 @@ process_arguments (int argc, char **argv) switch (c) { case 'h': /* help */ print_help (); - exit (STATE_OK); + exit (STATE_UNKNOWN); case 'V': /* version */ print_revision (progname, NP_VERSION); - exit (STATE_OK); + exit (STATE_UNKNOWN); case 'v': /* version */ verbose = TRUE; break; diff --git a/plugins/check_hpjd.c b/plugins/check_hpjd.c index 5fe06984..f159f5a2 100644 --- a/plugins/check_hpjd.c +++ b/plugins/check_hpjd.c @@ -350,10 +350,10 @@ process_arguments (int argc, char **argv) break; case 'V': /* version */ print_revision (progname, NP_VERSION); - exit (STATE_OK); + exit (STATE_UNKNOWN); case 'h': /* help */ print_help (); - exit (STATE_OK); + exit (STATE_UNKNOWN); case '?': /* help */ usage5 (); } diff --git a/plugins/check_http.c b/plugins/check_http.c index 9dc27656..68b470ce 100644 --- a/plugins/check_http.c +++ b/plugins/check_http.c @@ -267,11 +267,11 @@ process_arguments (int argc, char **argv) break; case 'h': /* help */ print_help (); - exit (STATE_OK); + exit (STATE_UNKNOWN); break; case 'V': /* version */ print_revision (progname, NP_VERSION); - exit (STATE_OK); + exit (STATE_UNKNOWN); break; case 't': /* timeout period */ if (!is_intnonneg (optarg)) diff --git a/plugins/check_ide_smart.c b/plugins/check_ide_smart.c index 47605e96..8d540ca1 100644 --- a/plugins/check_ide_smart.c +++ b/plugins/check_ide_smart.c @@ -234,10 +234,10 @@ main (int argc, char *argv[]) break; case 'h': print_help (); - return STATE_OK; + return STATE_UNKNOWN; case 'V': print_revision (progname, NP_VERSION); - return STATE_OK; + return STATE_UNKNOWN; default: usage5 (); } @@ -249,7 +249,7 @@ main (int argc, char *argv[]) if (!device) { print_help (); - return STATE_OK; + return STATE_UNKNOWN; } fd = open (device, OPEN_MODE); diff --git a/plugins/check_ldap.c b/plugins/check_ldap.c index cfc8222a..e70d6a51 100644 --- a/plugins/check_ldap.c +++ b/plugins/check_ldap.c @@ -325,10 +325,10 @@ process_arguments (int argc, char **argv) switch (c) { case 'h': /* help */ print_help (); - exit (STATE_OK); + exit (STATE_UNKNOWN); case 'V': /* version */ print_revision (progname, NP_VERSION); - exit (STATE_OK); + exit (STATE_UNKNOWN); case 't': /* timeout period */ if (!is_intnonneg (optarg)) usage2 (_("Timeout interval must be a positive integer"), optarg); diff --git a/plugins/check_load.c b/plugins/check_load.c index cde63e56..a96435f4 100644 --- a/plugins/check_load.c +++ b/plugins/check_load.c @@ -251,10 +251,10 @@ process_arguments (int argc, char **argv) break; case 'V': /* version */ print_revision (progname, NP_VERSION); - exit (STATE_OK); + exit (STATE_UNKNOWN); case 'h': /* help */ print_help (); - exit (STATE_OK); + exit (STATE_UNKNOWN); case '?': /* help */ usage5 (); } diff --git a/plugins/check_mrtg.c b/plugins/check_mrtg.c index cf3fe044..1fda5492 100644 --- a/plugins/check_mrtg.c +++ b/plugins/check_mrtg.c @@ -234,10 +234,10 @@ process_arguments (int argc, char **argv) break; case 'V': /* version */ print_revision (progname, NP_VERSION); - exit (STATE_OK); + exit (STATE_UNKNOWN); case 'h': /* help */ print_help (); - exit (STATE_OK); + exit (STATE_UNKNOWN); case '?': /* help */ usage5 (); } diff --git a/plugins/check_mrtgtraf.c b/plugins/check_mrtgtraf.c index 3b038cf1..eb66f622 100644 --- a/plugins/check_mrtgtraf.c +++ b/plugins/check_mrtgtraf.c @@ -270,10 +270,10 @@ process_arguments (int argc, char **argv) break; case 'V': /* version */ print_revision (progname, NP_VERSION); - exit (STATE_OK); + exit (STATE_UNKNOWN); case 'h': /* help */ print_help (); - exit (STATE_OK); + exit (STATE_UNKNOWN); case '?': /* help */ usage5 (); } diff --git a/plugins/check_mysql.c b/plugins/check_mysql.c index 216626bc..5773afd9 100644 --- a/plugins/check_mysql.c +++ b/plugins/check_mysql.c @@ -444,10 +444,10 @@ process_arguments (int argc, char **argv) break; case 'V': /* version */ print_revision (progname, NP_VERSION); - exit (STATE_OK); + exit (STATE_UNKNOWN); case 'h': /* help */ print_help (); - exit (STATE_OK); + exit (STATE_UNKNOWN); case 'v': verbose++; break; diff --git a/plugins/check_mysql_query.c b/plugins/check_mysql_query.c index 71ab7768..49a14dd3 100644 --- a/plugins/check_mysql_query.c +++ b/plugins/check_mysql_query.c @@ -250,10 +250,10 @@ process_arguments (int argc, char **argv) break; case 'V': /* version */ print_revision (progname, NP_VERSION); - exit (STATE_OK); + exit (STATE_UNKNOWN); case 'h': /* help */ print_help (); - exit (STATE_OK); + exit (STATE_UNKNOWN); case 'q': xasprintf(&sql_query, "%s", optarg); break; diff --git a/plugins/check_nagios.c b/plugins/check_nagios.c index 791b6dbe..40d68f03 100644 --- a/plugins/check_nagios.c +++ b/plugins/check_nagios.c @@ -235,10 +235,10 @@ process_arguments (int argc, char **argv) switch (c) { case 'h': /* help */ print_help (); - exit (STATE_OK); + exit (STATE_UNKNOWN); case 'V': /* version */ print_revision (progname, NP_VERSION); - exit (STATE_OK); + exit (STATE_UNKNOWN); case 'F': /* status log */ status_log = optarg; break; diff --git a/plugins/check_nt.c b/plugins/check_nt.c index f621b0a8..59c135db 100644 --- a/plugins/check_nt.c +++ b/plugins/check_nt.c @@ -553,10 +553,10 @@ int process_arguments(int argc, char **argv){ usage5 (); case 'h': /* help */ print_help(); - exit(STATE_OK); + exit(STATE_UNKNOWN); case 'V': /* version */ print_revision(progname, NP_VERSION); - exit(STATE_OK); + exit(STATE_UNKNOWN); case 'H': /* hostname */ server_address = optarg; break; diff --git a/plugins/check_ntp.c b/plugins/check_ntp.c index a7d278de..75efc289 100644 --- a/plugins/check_ntp.c +++ b/plugins/check_ntp.c @@ -691,11 +691,11 @@ int process_arguments(int argc, char **argv){ switch (c) { case 'h': print_help(); - exit(STATE_OK); + exit(STATE_UNKNOWN); break; case 'V': print_revision(progname, NP_VERSION); - exit(STATE_OK); + exit(STATE_UNKNOWN); break; case 'v': verbose++; diff --git a/plugins/check_ntp_peer.c b/plugins/check_ntp_peer.c index 44424af5..c656b0f5 100644 --- a/plugins/check_ntp_peer.c +++ b/plugins/check_ntp_peer.c @@ -448,11 +448,11 @@ int process_arguments(int argc, char **argv){ switch (c) { case 'h': print_help(); - exit(STATE_OK); + exit(STATE_UNKNOWN); break; case 'V': print_revision(progname, NP_VERSION); - exit(STATE_OK); + exit(STATE_UNKNOWN); break; case 'v': verbose++; diff --git a/plugins/check_ntp_time.c b/plugins/check_ntp_time.c index e344f8b7..295f86f6 100644 --- a/plugins/check_ntp_time.c +++ b/plugins/check_ntp_time.c @@ -477,11 +477,11 @@ int process_arguments(int argc, char **argv){ switch (c) { case 'h': print_help(); - exit(STATE_OK); + exit(STATE_UNKNOWN); break; case 'V': print_revision(progname, NP_VERSION); - exit(STATE_OK); + exit(STATE_UNKNOWN); break; case 'v': verbose++; diff --git a/plugins/check_nwstat.c b/plugins/check_nwstat.c index 1a7bfa16..e7e8de05 100644 --- a/plugins/check_nwstat.c +++ b/plugins/check_nwstat.c @@ -1354,10 +1354,10 @@ int process_arguments(int argc, char **argv) { usage5 (); case 'h': /* help */ print_help(); - exit(STATE_OK); + exit(STATE_UNKNOWN); case 'V': /* version */ print_revision(progname, NP_VERSION); - exit(STATE_OK); + exit(STATE_UNKNOWN); case 'H': /* hostname */ server_address=optarg; break; diff --git a/plugins/check_overcr.c b/plugins/check_overcr.c index af5eb9b9..9a4d25fa 100644 --- a/plugins/check_overcr.c +++ b/plugins/check_overcr.c @@ -340,10 +340,10 @@ process_arguments (int argc, char **argv) usage5 (); case 'h': /* help */ print_help (); - exit (STATE_OK); + exit (STATE_UNKNOWN); case 'V': /* version */ print_revision (progname, NP_VERSION); - exit (STATE_OK); + exit (STATE_UNKNOWN); case 'H': /* hostname */ server_address = optarg; break; diff --git a/plugins/check_pgsql.c b/plugins/check_pgsql.c index 9bad1ec5..2eb699e8 100644 --- a/plugins/check_pgsql.c +++ b/plugins/check_pgsql.c @@ -302,10 +302,10 @@ process_arguments (int argc, char **argv) usage5 (); case 'h': /* help */ print_help (); - exit (STATE_OK); + exit (STATE_UNKNOWN); case 'V': /* version */ print_revision (progname, NP_VERSION); - exit (STATE_OK); + exit (STATE_UNKNOWN); case 't': /* timeout period */ if (!is_integer (optarg)) usage2 (_("Timeout interval must be a positive integer"), optarg); diff --git a/plugins/check_ping.c b/plugins/check_ping.c index dbc5c3e4..423ecbe5 100644 --- a/plugins/check_ping.c +++ b/plugins/check_ping.c @@ -224,11 +224,11 @@ process_arguments (int argc, char **argv) usage5 (); case 'h': /* help */ print_help (); - exit (STATE_OK); + exit (STATE_UNKNOWN); break; case 'V': /* version */ print_revision (progname, NP_VERSION); - exit (STATE_OK); + exit (STATE_UNKNOWN); break; case 't': /* timeout period */ timeout_interval = atoi (optarg); diff --git a/plugins/check_procs.c b/plugins/check_procs.c index 402aac53..4bcc56bc 100644 --- a/plugins/check_procs.c +++ b/plugins/check_procs.c @@ -428,10 +428,10 @@ process_arguments (int argc, char **argv) usage5 (); case 'h': /* help */ print_help (); - exit (STATE_OK); + exit (STATE_UNKNOWN); case 'V': /* version */ print_revision (progname, NP_VERSION); - exit (STATE_OK); + exit (STATE_UNKNOWN); case 't': /* timeout period */ if (!is_integer (optarg)) usage2 (_("Timeout interval must be a positive integer"), optarg); diff --git a/plugins/check_radius.c b/plugins/check_radius.c index b2943475..03cbb8b0 100644 --- a/plugins/check_radius.c +++ b/plugins/check_radius.c @@ -259,10 +259,10 @@ process_arguments (int argc, char **argv) usage5 (); case 'h': /* help */ print_help (); - exit (OK); + exit (STATE_UNKNOWN); case 'V': /* version */ print_revision (progname, NP_VERSION); - exit (OK); + exit (STATE_UNKNOWN); case 'v': /* verbose mode */ verbose = TRUE; break; diff --git a/plugins/check_real.c b/plugins/check_real.c index 00bd4d20..6491e6e9 100644 --- a/plugins/check_real.c +++ b/plugins/check_real.c @@ -359,10 +359,10 @@ process_arguments (int argc, char **argv) break; case 'V': /* version */ print_revision (progname, NP_VERSION); - exit (STATE_OK); + exit (STATE_UNKNOWN); case 'h': /* help */ print_help (); - exit (STATE_OK); + exit (STATE_UNKNOWN); case '?': /* usage */ usage5 (); } diff --git a/plugins/check_smtp.c b/plugins/check_smtp.c index 24304534..56040ff2 100644 --- a/plugins/check_smtp.c +++ b/plugins/check_smtp.c @@ -623,10 +623,10 @@ process_arguments (int argc, char **argv) break; case 'V': /* version */ print_revision (progname, NP_VERSION); - exit (STATE_OK); + exit (STATE_UNKNOWN); case 'h': /* help */ print_help (); - exit (STATE_OK); + exit (STATE_UNKNOWN); case '?': /* help */ usage5 (); } diff --git a/plugins/check_snmp.c b/plugins/check_snmp.c index 62e6b8b3..28cc44dd 100644 --- a/plugins/check_snmp.c +++ b/plugins/check_snmp.c @@ -709,10 +709,10 @@ process_arguments (int argc, char **argv) usage5 (); case 'h': /* help */ print_help (); - exit (STATE_OK); + exit (STATE_UNKNOWN); case 'V': /* version */ print_revision (progname, NP_VERSION); - exit (STATE_OK); + exit (STATE_UNKNOWN); case 'v': /* verbose */ verbose++; break; diff --git a/plugins/check_ssh.c b/plugins/check_ssh.c index 3658965e..8ccbd5a7 100644 --- a/plugins/check_ssh.c +++ b/plugins/check_ssh.c @@ -128,10 +128,10 @@ process_arguments (int argc, char **argv) usage5 (); case 'V': /* version */ print_revision (progname, NP_VERSION); - exit (STATE_OK); + exit (STATE_UNKNOWN); case 'h': /* help */ print_help (); - exit (STATE_OK); + exit (STATE_UNKNOWN); case 'v': /* verbose */ verbose = TRUE; break; diff --git a/plugins/check_swap.c b/plugins/check_swap.c index 25e0bacd..4d5a4071 100644 --- a/plugins/check_swap.c +++ b/plugins/check_swap.c @@ -470,10 +470,10 @@ process_arguments (int argc, char **argv) break; case 'V': /* version */ print_revision (progname, NP_VERSION); - exit (STATE_OK); + exit (STATE_UNKNOWN); case 'h': /* help */ print_help (); - exit (STATE_OK); + exit (STATE_UNKNOWN); case '?': /* error */ usage5 (); } diff --git a/plugins/check_tcp.c b/plugins/check_tcp.c index 5c563d80..6dc9aa96 100644 --- a/plugins/check_tcp.c +++ b/plugins/check_tcp.c @@ -463,10 +463,10 @@ process_arguments (int argc, char **argv) usage5 (); case 'h': /* help */ print_help (); - exit (STATE_OK); + exit (STATE_UNKNOWN); case 'V': /* version */ print_revision (progname, NP_VERSION); - exit (STATE_OK); + exit (STATE_UNKNOWN); case 'v': /* verbose mode */ flags |= FLAG_VERBOSE; match_flags |= NP_MATCH_VERBOSE; diff --git a/plugins/check_time.c b/plugins/check_time.c index 3943742a..baf8c591 100644 --- a/plugins/check_time.c +++ b/plugins/check_time.c @@ -231,10 +231,10 @@ process_arguments (int argc, char **argv) usage5 (); case 'h': /* help */ print_help (); - exit (STATE_OK); + exit (STATE_UNKNOWN); case 'V': /* version */ print_revision (progname, NP_VERSION); - exit (STATE_OK); + exit (STATE_UNKNOWN); case 'H': /* hostname */ if (is_host (optarg) == FALSE) usage2 (_("Invalid hostname/address"), optarg); diff --git a/plugins/check_ups.c b/plugins/check_ups.c index 099881d0..dc5a348b 100644 --- a/plugins/check_ups.c +++ b/plugins/check_ups.c @@ -558,10 +558,10 @@ process_arguments (int argc, char **argv) break; case 'V': /* version */ print_revision (progname, NP_VERSION); - exit (STATE_OK); + exit (STATE_UNKNOWN); case 'h': /* help */ print_help (); - exit (STATE_OK); + exit (STATE_UNKNOWN); } } diff --git a/plugins/check_users.c b/plugins/check_users.c index a009f20b..54415a48 100644 --- a/plugins/check_users.c +++ b/plugins/check_users.c @@ -210,10 +210,10 @@ process_arguments (int argc, char **argv) usage5 (); case 'h': /* help */ print_help (); - exit (STATE_OK); + exit (STATE_UNKNOWN); case 'V': /* version */ print_revision (progname, NP_VERSION); - exit (STATE_OK); + exit (STATE_UNKNOWN); case 'c': /* critical */ if (!is_intnonneg (optarg)) usage4 (_("Critical threshold must be a positive integer")); -- cgit v1.2.3-74-g34f1 From bebf1cd050ecb0e23f02353e19125767623bd41f Mon Sep 17 00:00:00 2001 From: Sven Nierlein Date: Sun, 4 Oct 2015 19:03:50 +0200 Subject: use unknown exit code for help/version in plugins-root as well Signed-off-by: Sven Nierlein --- plugins-root/check_dhcp.c | 4 ++-- plugins-root/check_icmp.c | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/plugins-root/check_dhcp.c b/plugins-root/check_dhcp.c index b874c555..3723e61a 100644 --- a/plugins-root/check_dhcp.c +++ b/plugins-root/check_dhcp.c @@ -1163,11 +1163,11 @@ int call_getopt(int argc, char **argv){ case 'V': /* version */ print_revision(progname, NP_VERSION); - exit(STATE_OK); + exit(STATE_UNKNOWN); case 'h': /* help */ print_help(); - exit(STATE_OK); + exit(STATE_UNKNOWN); case 'v': /* verbose */ verbose=1; diff --git a/plugins-root/check_icmp.c b/plugins-root/check_icmp.c index f4208371..9ed12ba1 100644 --- a/plugins-root/check_icmp.c +++ b/plugins-root/check_icmp.c @@ -526,10 +526,10 @@ main(int argc, char **argv) break; case 'V': /* version */ print_revision (progname, NP_VERSION); - exit (STATE_OK); + exit (STATE_UNKNOWN); case 'h': /* help */ print_help (); - exit (STATE_OK); + exit (STATE_UNKNOWN); } } } -- cgit v1.2.3-74-g34f1