From 44f8455b2cf248c6f50c35bfc3510d2946084c5b Mon Sep 17 00:00:00 2001 From: Thomas Guyot-Sionnest Date: Wed, 7 May 2008 10:02:42 +0000 Subject: Added support for --extra-opts in all C plugins (disabled by default, see configure --help) git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@1991 f882894a-f735-0410-b71e-b25c423dba1c diff --git a/plugins-root/check_dhcp.c b/plugins-root/check_dhcp.c index 9b62b3e..241f13e 100644 --- a/plugins-root/check_dhcp.c +++ b/plugins-root/check_dhcp.c @@ -268,6 +268,9 @@ int main(int argc, char **argv){ bindtextdomain (PACKAGE, LOCALEDIR); textdomain (PACKAGE); + /* Parse extra opts if any */ + argv=np_extra_opts(&argc, argv, progname); + if(process_arguments(argc,argv)!=OK){ usage4 (_("Could not parse arguments")); } @@ -1395,6 +1398,7 @@ void print_help(void){ print_usage(); printf (_(UT_HELP_VRSN)); + printf (_(UT_EXTRA_OPTS)); printf (_(UT_VERBOSE)); @@ -1411,6 +1415,12 @@ void print_help(void){ printf (" %s\n", "-u, --unicast"); printf (" %s\n", _("Unicast testing: mimic a DHCP relay, requires -s")); +#ifdef NP_EXTRA_OPTS + printf ("\n"); + printf ("%s\n", _("Notes:")); + printf (_(UT_EXTRA_OPTS_NOTES)); +#endif + printf (_(UT_SUPPORT)); return; } diff --git a/plugins-root/check_icmp.c b/plugins-root/check_icmp.c index a059f26..f3e5f0d 100644 --- a/plugins-root/check_icmp.c +++ b/plugins-root/check_icmp.c @@ -447,6 +447,9 @@ main(int argc, char **argv) packets = 5; } + /* Parse extra opts if any */ + argv=np_extra_opts(&argc, argv, progname); + /* parse the arguments */ for(i = 1; i < argc; i++) { while((arg = getopt(argc, argv, "vhVw:c:n:p:t:H:s:i:b:I:l:m:")) != EOF) { @@ -1262,6 +1265,7 @@ print_help(void) print_usage (); printf (_(UT_HELP_VRSN)); + printf (_(UT_EXTRA_OPTS)); printf (" %s\n", "-H"); printf (" %s\n", _("specify a target")); @@ -1310,10 +1314,13 @@ print_help(void) printf ("%s\n\n", _("NOTE: Some systems decrease TTL when forming ICMP_ECHOREPLY, others do not."));*/ printf ("\n"); printf (" %s\n", _("The -v switch can be specified several times for increased verbosity.")); - /* printf ("%s\n", _("Long options are currently unsupported.")); printf ("%s\n", _("Options marked with * require an argument")); */ +#ifdef NP_EXTRA_OPTS + printf ("\n"); + printf (_(UT_EXTRA_OPTS_NOTES)); +#endif printf (_(UT_SUPPORT)); } diff --git a/plugins/check_apt.c b/plugins/check_apt.c index bd59c70..440755d 100644 --- a/plugins/check_apt.c +++ b/plugins/check_apt.c @@ -88,6 +88,9 @@ static int exec_warning = 0; /* if a cmd exited non-zero */ int main (int argc, char **argv) { int result=STATE_UNKNOWN, packages_available=0, sec_count=0; + /* Parse extra opts if any */ + argv=np_extra_opts(&argc, argv, progname); + if (process_arguments(argc, argv) == ERROR) usage_va(_("Could not parse arguments")); @@ -414,6 +417,7 @@ print_help (void) print_usage(); printf(_(UT_HELP_VRSN)); + printf(_(UT_EXTRA_OPTS)); printf(_(UT_TIMEOUT), timeout_interval); @@ -454,6 +458,12 @@ print_help (void) printf (" %s\n", _("timeout (with -t) to prevent the plugin from timing out if apt-get")); printf (" %s\n", _("upgrade is expected to take longer than the default timeout.")); +#ifdef NP_EXTRA_OPTS + printf("\n"); + printf("%s\n", _("Notes:")); + printf(_(UT_EXTRA_OPTS_NOTES)); +#endif + printf(_(UT_SUPPORT)); } diff --git a/plugins/check_by_ssh.c b/plugins/check_by_ssh.c index 37874bf..9def404 100644 --- a/plugins/check_by_ssh.c +++ b/plugins/check_by_ssh.c @@ -76,6 +76,9 @@ main (int argc, char **argv) bindtextdomain (PACKAGE, LOCALEDIR); textdomain (PACKAGE); + /* Parse extra opts if any */ + argv=np_extra_opts (&argc, argv, progname); + /* process arguments */ if (process_arguments (argc, argv) == ERROR) usage_va(_("Could not parse arguments")); @@ -350,6 +353,8 @@ print_help (void) printf (_(UT_HELP_VRSN)); + printf (_(UT_EXTRA_OPTS)); + printf (_(UT_HOST_PORT), 'p', "none"); printf (_(UT_IPv46)); @@ -402,6 +407,12 @@ print_help (void) printf (" %s\n", "[1080933700] PROCESS_SERVICE_CHECK_RESULT;flint;c2;0; up 2 days"); printf (" %s\n", "[1080933700] PROCESS_SERVICE_CHECK_RESULT;flint;c3;0; up 2 days"); +#ifdef NP_EXTRA_OPTS + printf("\n"); + printf("%s\n", _("Notes:")); + printf(_(UT_EXTRA_OPTS_NOTES)); +#endif + printf(_(UT_SUPPORT)); } diff --git a/plugins/check_cluster.c b/plugins/check_cluster.c index ac3eece..d493149 100644 --- a/plugins/check_cluster.c +++ b/plugins/check_cluster.c @@ -74,6 +74,9 @@ int main(int argc, char **argv){ bindtextdomain (PACKAGE, LOCALEDIR); textdomain (PACKAGE); + /* Parse extra opts if any */ + argv=np_extra_opts(&argc, argv, progname); + if(process_arguments(argc,argv)==ERROR) usage(_("Could not parse arguments")); @@ -236,6 +239,7 @@ print_help(void) printf("\n"); printf("%s\n", _("Options:")); + printf(_(UT_EXTRA_OPTS)); printf (" %s\n", "-s, --service"); printf (" %s\n", _("Check service cluster status")); printf (" %s\n", "-h, --host"); @@ -257,6 +261,10 @@ print_help(void) printf("\n"); printf("%s\n", _("Notes:")); printf(_(UT_THRESHOLDS_NOTES)); +#ifdef NP_EXTRA_OPTS + printf ("\n"); + printf (_(UT_EXTRA_OPTS_NOTES)); +#endif printf(_(UT_SUPPORT)); } diff --git a/plugins/check_dig.c b/plugins/check_dig.c index d7e1f57..e3f7adb 100644 --- a/plugins/check_dig.c +++ b/plugins/check_dig.c @@ -84,6 +84,9 @@ main (int argc, char **argv) if (signal (SIGALRM, popen_timeout_alarm_handler) == SIG_ERR) usage_va(_("Cannot catch SIGALRM")); + /* Parse extra opts if any */ + argv=np_extra_opts (&argc, argv, progname); + if (process_arguments (argc, argv) == ERROR) usage_va(_("Could not parse arguments")); @@ -317,6 +320,8 @@ print_help (void) printf (_(UT_HELP_VRSN)); + printf (_(UT_EXTRA_OPTS)); + printf (_(UT_HOST_PORT), 'p', myport); printf (" %s\n","-l, --query_address=STRING"); @@ -332,11 +337,17 @@ print_help (void) printf (_(UT_TIMEOUT), DEFAULT_SOCKET_TIMEOUT); printf (_(UT_VERBOSE)); - printf("\n"); + printf ("\n"); printf ("%s\n", _("Examples:")); printf (" %s\n", "check_dig -H DNSSERVER -l www.example.com -A \"+tcp\""); printf (" %s\n", "This will send a tcp query to DNSSERVER for www.example.com"); +#ifdef NP_EXTRA_OPTS + printf ("\n"); + printf ("%s\n", _("Notes:")); + printf (_(UT_EXTRA_OPTS_NOTES)); +#endif + printf (_(UT_SUPPORT)); } diff --git a/plugins/check_disk.c b/plugins/check_disk.c index 7048a56..e9e7219 100644 --- a/plugins/check_disk.c +++ b/plugins/check_disk.c @@ -192,6 +192,9 @@ main (int argc, char **argv) mount_list = read_file_system_list (0); + /* Parse extra opts if any */ + argv = np_extra_opts (&argc, argv, progname); + if (process_arguments (argc, argv) == ERROR) usage4 (_("Could not parse arguments")); @@ -903,6 +906,7 @@ print_help (void) print_usage (); printf (_(UT_HELP_VRSN)); + printf (_(UT_EXTRA_OPTS)); printf (" %s\n", "-w, --warning=INTEGER"); printf (" %s\n", _("Exit with WARNING status if less than INTEGER units of disk are free")); @@ -955,6 +959,13 @@ print_help (void) printf (_(UT_VERBOSE)); printf (" %s\n", "-X, --exclude-type=TYPE"); printf (" %s\n", _("Ignore all filesystems of indicated type (may be repeated)")); + +#ifdef NP_EXTRA_OPTS + printf ("\n"); + printf ("%s\n", _("Notes:")); + printf (_(UT_EXTRA_OPTS_NOTES)); +#endif + printf ("\n"); printf ("%s\n", _("Examples:")); printf (" %s\n", "check_disk -w 10% -c 5% -p /tmp -p /var -C -w 100000 -c 50000 -p /"); diff --git a/plugins/check_dns.c b/plugins/check_dns.c index f8dbb4d..1384064 100644 --- a/plugins/check_dns.c +++ b/plugins/check_dns.c @@ -99,6 +99,9 @@ main (int argc, char **argv) usage_va(_("Cannot catch SIGALRM")); } + /* Parse extra opts if any */ + argv=np_extra_opts (&argc, argv, progname); + if (process_arguments (argc, argv) == ERROR) { usage_va(_("Could not parse arguments")); } @@ -457,6 +460,7 @@ print_help (void) print_usage (); printf (_(UT_HELP_VRSN)); + printf (_(UT_EXTRA_OPTS)); printf (" -H, --hostname=HOST\n"); printf (" %s\n", _("The name or address you want to query")); @@ -475,6 +479,13 @@ print_help (void) printf (" %s\n", _("Return critical if elapsed time exceeds value. Default off")); printf (_(UT_TIMEOUT), DEFAULT_SOCKET_TIMEOUT); + +#ifdef NP_EXTRA_OPTS + printf ("\n"); + printf ("%s\n", _("Notes:")); + printf (_(UT_EXTRA_OPTS_NOTES)); +#endif + printf (_(UT_SUPPORT)); } diff --git a/plugins/check_fping.c b/plugins/check_fping.c index 8617871..5a0ab8c 100644 --- a/plugins/check_fping.c +++ b/plugins/check_fping.c @@ -83,6 +83,9 @@ main (int argc, char **argv) bindtextdomain (PACKAGE, LOCALEDIR); textdomain (PACKAGE); + /* Parse extra opts if any */ + argv=np_extra_opts (&argc, argv, progname); + if (process_arguments (argc, argv) == ERROR) usage4 (_("Could not parse arguments")); @@ -379,6 +382,7 @@ print_help (void) print_usage (); printf (_(UT_HELP_VRSN)); + printf (_(UT_EXTRA_OPTS)); printf (" %s\n", "-H, --hostname=HOST"); printf (" %s\n", _("name or IP Address of host to ping (IP Address bypasses name lookup, reducing system load)")); @@ -395,6 +399,13 @@ print_help (void) printf (" %s\n", _("THRESHOLD is ,%% where is the round trip average travel time (ms)")); printf (" %s\n", _("which triggers a WARNING or CRITICAL state, and is the percentage of")); printf (" %s\n", _("packet loss to trigger an alarm state.")); + +#ifdef NP_EXTRA_OPTS + printf ("\n"); + printf ("%s\n", _("Notes:")); + printf (_(UT_EXTRA_OPTS_NOTES)); +#endif + printf (_(UT_SUPPORT)); } diff --git a/plugins/check_game.c b/plugins/check_game.c index 0e4120d..4bc57c8 100644 --- a/plugins/check_game.c +++ b/plugins/check_game.c @@ -79,6 +79,9 @@ main (int argc, char **argv) bindtextdomain (PACKAGE, LOCALEDIR); textdomain (PACKAGE); + /* Parse extra opts if any */ + argv=np_extra_opts (&argc, argv, progname); + if (process_arguments (argc, argv) == ERROR) usage_va(_("Could not parse arguments")); @@ -302,6 +305,7 @@ print_help (void) print_usage (); printf (_(UT_HELP_VRSN)); + printf (_(UT_EXTRA_OPTS)); printf (" %s\n", "-p"); printf (" %s\n", _("Optional port of which to connect")); @@ -319,6 +323,10 @@ print_help (void) printf (" %s\n", _("This plugin uses the 'qstat' command, the popular game server status query tool.")); printf (" %s\n", _("If you don't have the package installed, you will need to download it from")); printf (" %s\n", _("http://www.activesw.com/people/steve/qstat.html before you can use this plugin.")); +#ifdef NP_EXTRA_OPTS + printf ("\n"); + printf (_(UT_EXTRA_OPTS_NOTES)); +#endif printf (_(UT_SUPPORT)); } diff --git a/plugins/check_hpjd.c b/plugins/check_hpjd.c index e20a76d..044f08f 100644 --- a/plugins/check_hpjd.c +++ b/plugins/check_hpjd.c @@ -100,6 +100,9 @@ main (int argc, char **argv) bindtextdomain (PACKAGE, LOCALEDIR); textdomain (PACKAGE); + /* Parse extra opts if any */ + argv=np_extra_opts (&argc, argv, progname); + if (process_arguments (argc, argv) == ERROR) usage4 (_("Could not parse arguments")); @@ -390,19 +393,26 @@ print_help (void) printf (COPYRIGHT, copyright, email); printf ("%s\n", _("This plugin tests the STATUS of an HP printer with a JetDirect card.")); - printf ("%s\n", _("Net-snmp must be installed on the computer running the plugin.")); + printf ("%s\n", _("Net-snmp must be installed on the computer running the plugin.")); - printf ("\n\n"); + printf ("\n\n"); print_usage (); printf (_(UT_HELP_VRSN)); + printf (_(UT_EXTRA_OPTS)); printf (" %s\n", "-C, --community=STRING"); - printf (" %s", _("The SNMP community name ")); - printf (_("(default=%s)"), DEFAULT_COMMUNITY); + printf (" %s", _("The SNMP community name ")); + printf (_("(default=%s)"), DEFAULT_COMMUNITY); + printf ("\n"); + +#ifdef NP_EXTRA_OPTS + printf ("\n"); + printf ("%s\n", _("Notes:")); + printf (_(UT_EXTRA_OPTS_NOTES)); +#endif - printf ("\n"); printf (_(UT_SUPPORT)); } diff --git a/plugins/check_http.c b/plugins/check_http.c index 81071d7..42636cd 100644 --- a/plugins/check_http.c +++ b/plugins/check_http.c @@ -147,6 +147,9 @@ main (int argc, char **argv) asprintf (&user_agent, "User-Agent: check_http/%s (nagios-plugins %s)", clean_revstring (revision), VERSION); + /* Parse extra opts if any */ + argv=np_extra_opts (&argc, argv, progname); + if (process_arguments (argc, argv) == ERROR) usage4 (_("Could not parse arguments")); @@ -1232,6 +1235,7 @@ print_help (void) printf ("\n"); printf (_(UT_HELP_VRSN)); + printf (_(UT_EXTRA_OPTS)); printf (" %s\n", "-H, --hostname=ADDRESS"); printf (" %s\n", _("Host name argument for servers using host headers (virtual host)")); @@ -1299,19 +1303,24 @@ print_help (void) printf (_(UT_VERBOSE)); - printf (_("Notes:")); + printf ("\n"); + printf ("%s\n", _("Notes:")); printf (" %s\n", _("This plugin will attempt to open an HTTP connection with the host.")); printf (" %s\n", _("Successful connects return STATE_OK, refusals and timeouts return STATE_CRITICAL")); printf (" %s\n", _("other errors return STATE_UNKNOWN. Successful connects, but incorrect reponse")); printf (" %s\n", _("messages from the host result in STATE_WARNING return values. If you are")); printf (" %s\n", _("checking a virtual server that uses 'host headers' you must supply the FQDN")); printf (" %s\n", _("(fully qualified domain name) as the [host_name] argument.")); + printf ("\n"); + printf (_(UT_EXTRA_OPTS_NOTES)); #ifdef HAVE_SSL + printf ("\n"); printf (" %s\n", _("This plugin can also check whether an SSL enabled web server is able to")); printf (" %s\n", _("serve content (optionally within a specified time) or whether the X509 ")); printf (" %s\n", _("certificate is still valid for the specified number of days.")); - printf (_("Examples:")); + printf ("\n"); + printf ("%s\n", _("Examples:")); printf (" %s\n\n", "CHECK CONTENT: check_http -w 5 -c 10 --ssl -H www.verisign.com"); printf (" %s\n", _("When the 'www.verisign.com' server returns its content within 5 seconds,")); printf (" %s\n", _("a STATE_OK will be returned. When the server returns its content but exceeds")); diff --git a/plugins/check_ide_smart.c b/plugins/check_ide_smart.c index 937f84c..02f07c0 100644 --- a/plugins/check_ide_smart.c +++ b/plugins/check_ide_smart.c @@ -162,6 +162,9 @@ main (int argc, char *argv[]) values_t values; int fd; + /* Parse extra opts if any */ + argv=np_extra_opts (&argc, argv, progname); + static struct option longopts[] = { {"device", required_argument, 0, 'd'}, {"immediate", no_argument, 0, 'i'}, @@ -490,6 +493,7 @@ print_help (void) print_usage (); printf (_(UT_HELP_VRSN)); + printf (_(UT_EXTRA_OPTS)); printf (" %s\n", "-d, --device=DEVICE"); printf (" %s\n", _("Select device DEVICE")); @@ -504,6 +508,13 @@ print_help (void) printf (" %s\n", _("Turn off automatic offline tests")); printf (" %s\n", "-n, --nagios"); printf (" %s\n", _("Output suitable for Nagios")); + +#ifdef NP_EXTRA_OPTS + printf ("\n"); + printf ("%s\n", _("Notes:")); + printf (_(UT_EXTRA_OPTS_NOTES)); +#endif + printf (_(UT_SUPPORT)); } diff --git a/plugins/check_ldap.c b/plugins/check_ldap.c index 74ca3b0..3d6f05c 100644 --- a/plugins/check_ldap.c +++ b/plugins/check_ldap.c @@ -104,7 +104,10 @@ main (int argc, char *argv[]) if (strstr(argv[0],"check_ldaps")) { asprintf (&progname, "check_ldaps"); } - + + /* Parse extra opts if any */ + argv=np_extra_opts (&argc, argv, progname); + if (process_arguments (argc, argv) == ERROR) usage4 (_("Could not parse arguments")); @@ -392,11 +395,12 @@ print_help (void) printf ("Copyright (c) 1999 Didi Rieder (adrieder@sbox.tu-graz.ac.at)\n"); printf (COPYRIGHT, copyright, email); - printf ("\n\n"); + printf ("\n\n"); print_usage (); printf (_(UT_HELP_VRSN)); + printf (_(UT_EXTRA_OPTS)); printf (_(UT_HOST_PORT), 'p', myport); @@ -429,12 +433,17 @@ print_help (void) printf (_(UT_VERBOSE)); - printf ("\n%s\n", _("Notes:")); + printf ("\n"); + printf ("%s\n", _("Notes:")); printf (" %s\n", _("If this plugin is called via 'check_ldaps', method 'STARTTLS' will be")); - printf (_(" implied (using default port %i) unless --port=636 is specified. In that case %s"), DEFAULT_PORT, "\n"); + printf (_(" implied (using default port %i) unless --port=636 is specified. In that case\n"), DEFAULT_PORT); printf (" %s\n", _("'SSL on connect' will be used no matter how the plugin was called.")); printf (" %s\n", _("This detection is deprecated, please use 'check_ldap' with the '--starttls' or '--ssl' flags")); printf (" %s\n", _("to define the behaviour explicitly instead.")); +#ifdef NP_EXTRA_OPTS + printf ("\n"); + printf (_(UT_EXTRA_OPTS_NOTES)); +#endif printf (_(UT_SUPPORT)); } diff --git a/plugins/check_load.c b/plugins/check_load.c index f4faa31..5ff9a8c 100644 --- a/plugins/check_load.c +++ b/plugins/check_load.c @@ -119,6 +119,9 @@ main (int argc, char **argv) textdomain (PACKAGE); setlocale(LC_NUMERIC, "POSIX"); + /* Parse extra opts if any */ + argv = np_extra_opts (&argc, argv, progname); + if (process_arguments (argc, argv) == ERROR) usage4 (_("Could not parse arguments")); @@ -307,6 +310,7 @@ print_help (void) print_usage (); printf (_(UT_HELP_VRSN)); + printf (_(UT_EXTRA_OPTS)); printf (" %s\n", "-w, --warning=WLOAD1,WLOAD5,WLOAD15"); printf (" %s\n", _("Exit with WARNING status if load average exceeds WLOADn")); @@ -316,6 +320,12 @@ print_help (void) printf (" %s\n", "-r, --percpu"); printf (" %s\n", _("Divide the load averages by the number of CPUs (when possible)")); +#ifdef NP_EXTRA_OPTS + printf ("\n"); + printf ("%s\n", _("Notes:")); + printf (_(UT_EXTRA_OPTS_NOTES)); +#endif + printf (_(UT_SUPPORT)); } diff --git a/plugins/check_mrtg.c b/plugins/check_mrtg.c index cf77f8b..80e5215 100644 --- a/plugins/check_mrtg.c +++ b/plugins/check_mrtg.c @@ -72,6 +72,9 @@ main (int argc, char **argv) bindtextdomain (PACKAGE, LOCALEDIR); textdomain (PACKAGE); + /* Parse extra opts if any */ + argv=np_extra_opts (&argc, argv, progname); + if (process_arguments (argc, argv) == ERROR) usage4 (_("Could not parse arguments\n")); @@ -327,6 +330,7 @@ print_help (void) print_usage (); printf (_(UT_HELP_VRSN)); + printf (_(UT_EXTRA_OPTS)); printf (" %s\n", "-F, --logfile=FILE"); printf (" %s\n", _("The MRTG log file containing the data you want to monitor")); @@ -367,6 +371,9 @@ print_help (void) printf (" %s\n", _("you can always hack the code to make this plugin work for you...")); printf (" %s\n", _("- MRTG stands for the Multi Router Traffic Grapher. It can be downloaded from")); printf (" %s\n", "http://ee-staff.ethz.ch/~oetiker/webtools/mrtg/mrtg.html"); +#ifdef NP_EXTRA_OPTS + printf (" -%s", _(UT_EXTRA_OPTS_NOTES)); +#endif printf (_(UT_SUPPORT)); } diff --git a/plugins/check_mrtgtraf.c b/plugins/check_mrtgtraf.c index 5ba5cdc..b971616 100644 --- a/plugins/check_mrtgtraf.c +++ b/plugins/check_mrtgtraf.c @@ -80,6 +80,9 @@ main (int argc, char **argv) bindtextdomain (PACKAGE, LOCALEDIR); textdomain (PACKAGE); + /* Parse extra opts if any */ + argv=np_extra_opts (&argc, argv, progname); + if (process_arguments (argc, argv) == ERROR) usage4 (_("Could not parse arguments")); @@ -347,6 +350,7 @@ print_help (void) print_usage (); printf (_(UT_HELP_VRSN)); + printf (_(UT_EXTRA_OPTS)); printf (" %s\n", "-F, --filename=STRING"); printf (" %s\n", _("File to read log from")); @@ -368,6 +372,9 @@ print_help (void) printf (" %s\n", _("- The calculated i/o rates are a little off from what MRTG actually")); printf (" %s\n", _(" reports. I'm not sure why this is right now, but will look into it")); printf (" %s\n", _(" for future enhancements of this plugin.")); +#ifdef NP_EXTRA_OPTS + printf (" -%s", _(UT_EXTRA_OPTS_NOTES)); +#endif printf (_(UT_SUPPORT)); } diff --git a/plugins/check_mysql.c b/plugins/check_mysql.c index 3d7426d..a9f0f60 100644 --- a/plugins/check_mysql.c +++ b/plugins/check_mysql.c @@ -82,6 +82,9 @@ main (int argc, char **argv) bindtextdomain (PACKAGE, LOCALEDIR); textdomain (PACKAGE); + /* Parse extra opts if any */ + argv=np_extra_opts (&argc, argv, progname); + if (process_arguments (argc, argv) == ERROR) usage4 (_("Could not parse arguments")); @@ -385,6 +388,7 @@ print_help (void) print_usage (); printf (_(UT_HELP_VRSN)); + printf (_(UT_EXTRA_OPTS)); printf (_(UT_HOST_PORT), 'P', myport); printf (" %s\n", "-s, --socket=STRING"); @@ -412,6 +416,12 @@ print_help (void) printf (" %s\n", _("using the default unix socket. You can force TCP on localhost by using an")); printf (" %s\n", _("IP address or FQDN ('localhost' will use the socket as well).")); +#ifdef NP_EXTRA_OPTS + printf ("\n"); + printf ("%s\n", _("Notes:")); + printf (_(UT_EXTRA_OPTS_NOTES)); +#endif + printf (_(UT_SUPPORT)); } diff --git a/plugins/check_mysql_query.c b/plugins/check_mysql_query.c index 171fc69..6c5e436 100644 --- a/plugins/check_mysql_query.c +++ b/plugins/check_mysql_query.c @@ -78,6 +78,9 @@ main (int argc, char **argv) bindtextdomain (PACKAGE, LOCALEDIR); textdomain (PACKAGE); + /* Parse extra opts if any */ + argv=np_extra_opts (&argc, argv, progname); + if (process_arguments (argc, argv) == ERROR) usage4 (_("Could not parse arguments")); @@ -294,6 +297,7 @@ print_help (void) print_usage (); printf (_(UT_HELP_VRSN)); + printf (_(UT_EXTRA_OPTS)); printf (" -q, --query=STRING\n"); printf (" %s\n", _("SQL query to run. Only first column in first row will be read")); printf (_(UT_WARN_CRIT_RANGE)); @@ -313,6 +317,12 @@ print_help (void) printf (" %s\n", _("A query is required. The result from the query should be numeric.")); printf (" %s\n", _("For extra security, create a user with minimal access.")); +#ifdef NP_EXTRA_OPTS + printf ("\n"); + printf ("%s\n", _("Notes:")); + printf (_(UT_EXTRA_OPTS_NOTES)); +#endif + printf (_(UT_SUPPORT)); } diff --git a/plugins/check_nagios.c b/plugins/check_nagios.c index 1f8df33..dfe6080 100644 --- a/plugins/check_nagios.c +++ b/plugins/check_nagios.c @@ -88,6 +88,9 @@ main (int argc, char **argv) bindtextdomain (PACKAGE, LOCALEDIR); textdomain (PACKAGE); + /* Parse extra opts if any */ + argv=np_extra_opts (&argc, argv, progname); + if (process_arguments (argc, argv) == ERROR) usage_va(_("Could not parse arguments")); @@ -289,6 +292,7 @@ print_help (void) print_usage (); printf (_(UT_HELP_VRSN)); + printf (_(UT_EXTRA_OPTS)); printf (" %s\n", "-F, --filename=FILE"); printf (" %s\n", _("Name of the log file to check")); @@ -297,6 +301,13 @@ print_help (void) printf (" %s\n", "-C, --command=STRING"); printf (" %s\n", _("Substring to search for in process arguments")); printf (_(UT_VERBOSE)); + +#ifdef NP_EXTRA_OPTS + printf ("\n"); + printf ("%s\n", _("Notes:")); + printf (_(UT_EXTRA_OPTS_NOTES)); +#endif + printf ("\n"); printf ("%s\n", _("Examples:")); printf (" %s\n", "check_nagios -e 5 -F /usr/local/nagios/var/status.log -C /usr/local/nagios/bin/nagios"); diff --git a/plugins/check_nt.c b/plugins/check_nt.c index 681b842..ef1b530 100644 --- a/plugins/check_nt.c +++ b/plugins/check_nt.c @@ -122,6 +122,9 @@ int main(int argc, char **argv){ bindtextdomain (PACKAGE, LOCALEDIR); textdomain (PACKAGE); + /* Parse extra opts if any */ + argv=np_extra_opts (&argc, argv, progname); + if(process_arguments(argc,argv) == ERROR) usage4 (_("Could not parse arguments")); @@ -644,8 +647,9 @@ void print_help(void) print_usage(); printf (_(UT_HELP_VRSN)); + printf (_(UT_EXTRA_OPTS)); - printf ("%s\n", _("Options:")); + printf ("%s\n", _("Options:")); printf (" %s\n", "-H, --hostname=HOST"); printf (" %s\n", _("Name of the host to check")); printf (" %s\n", "-p, --port=INTEGER"); @@ -729,6 +733,9 @@ void print_help(void) printf (" %s\n", _("output when this happens contains \"Cannot map xxxxx to protocol number\".")); printf (" %s\n", _("One fix for this is to change the port to something else on check_nt ")); printf (" %s\n", _("and on the client service it\'s connecting to.")); +#ifdef NP_EXTRA_OPTS + printf (" -%s", _(UT_EXTRA_OPTS_NOTES)); +#endif printf (_(UT_SUPPORT)); } diff --git a/plugins/check_ntp.c b/plugins/check_ntp.c index 69c25f0..68c82d1 100644 --- a/plugins/check_ntp.c +++ b/plugins/check_ntp.c @@ -763,6 +763,9 @@ int main(int argc, char *argv[]){ result = offset_result = jitter_result = STATE_OK; + /* Parse extra opts if any */ + argv=np_extra_opts (&argc, argv, progname); + if (process_arguments (argc, argv) == ERROR) usage4 (_("Could not parse arguments")); @@ -844,6 +847,7 @@ void print_help(void){ print_usage(); printf (_(UT_HELP_VRSN)); + printf (_(UT_EXTRA_OPTS)); printf (_(UT_HOST_PORT), 'p', "123"); printf (" %s\n", "-w, --warning=THRESHOLD"); printf (" %s\n", _("Offset to result in warning status (seconds)")); @@ -859,11 +863,16 @@ void print_help(void){ printf("\n"); printf("%s\n", _("Notes:")); printf(_(UT_THRESHOLDS_NOTES)); +#ifdef NP_EXTRA_OPTS + printf("\n"); + printf(_(UT_EXTRA_OPTS_NOTES)); +#endif printf("\n"); printf("%s\n", _("Examples:")); printf(" %s\n", _("Normal offset check:")); printf(" %s\n", ("./check_ntp -H ntpserv -w 0.5 -c 1")); + printf("\n"); printf(" %s\n", _("Check jitter too, avoiding critical notifications if jitter isn't available")); printf(" %s\n", _("(See Notes above for more details on thresholds formats):")); printf(" %s\n", ("./check_ntp -H ntpserv -w 0.5 -c 1 -j -1:100 -k -1:200")); diff --git a/plugins/check_ntp_peer.c b/plugins/check_ntp_peer.c index 5ed97db..67ee0a7 100644 --- a/plugins/check_ntp_peer.c +++ b/plugins/check_ntp_peer.c @@ -552,6 +552,9 @@ int main(int argc, char *argv[]){ bindtextdomain (PACKAGE, LOCALEDIR); textdomain (PACKAGE); + /* Parse extra opts if any */ + argv=np_extra_opts (&argc, argv, progname); + if (process_arguments (argc, argv) == ERROR) usage4 (_("Could not parse arguments")); @@ -638,6 +641,7 @@ void print_help(void){ print_usage(); printf (_(UT_HELP_VRSN)); + printf (_(UT_EXTRA_OPTS)); printf (_(UT_HOST_PORT), 'p', "123"); printf (" %s\n", "-q, --quiet"); printf (" %s\n", _("Returns UNKNOWN instead of CRITICAL or WARNING if server isn't synchronized")); @@ -664,17 +668,23 @@ void print_help(void){ printf(" %s\n", _("Use this plugin to check the health of an NTP server. It supports")); printf(" %s\n", _("checking the offset with the sync peer, the jitter and stratum. This")); printf(" %s\n", _("plugin will not check the clock offset between the local host and NTP")); - printf(" %s\n\n", _("server; please use check_ntp_time for that purpose.")); - + printf(" %s\n", _("server; please use check_ntp_time for that purpose.")); + printf("\n"); printf(_(UT_THRESHOLDS_NOTES)); +#ifdef NP_EXTRA_OPTS + printf("\n"); + printf(_(UT_EXTRA_OPTS_NOTES)); +#endif printf("\n"); printf("%s\n", _("Examples:")); printf(" %s\n", _("Simple NTP server check:")); printf(" %s\n", ("./check_ntp_peer -H ntpserv -w 0.5 -c 1")); + printf("\n"); printf(" %s\n", _("Check jitter too, avoiding critical notifications if jitter isn't available")); printf(" %s\n", _("(See Notes above for more details on thresholds formats):")); printf(" %s\n", ("./check_ntp_peer -H ntpserv -w 0.5 -c 1 -j -1:100 -k -1:200")); + printf("\n"); printf(" %s\n", _("Check only stratum:")); printf(" %s\n", ("./check_ntp_peer -H ntpserv -W 4 -C 6")); diff --git a/plugins/check_ntp_time.c b/plugins/check_ntp_time.c index ec41429..ea24a0e 100644 --- a/plugins/check_ntp_time.c +++ b/plugins/check_ntp_time.c @@ -540,6 +540,9 @@ int main(int argc, char *argv[]){ result = offset_result = STATE_OK; + /* Parse extra opts if any */ + argv=np_extra_opts (&argc, argv, progname); + if (process_arguments (argc, argv) == ERROR) usage4 (_("Could not parse arguments")); @@ -597,6 +600,7 @@ void print_help(void){ print_usage(); printf (_(UT_HELP_VRSN)); + printf (_(UT_EXTRA_OPTS)); printf (_(UT_HOST_PORT), 'p', "123"); printf (" %s\n", "-q, --quiet"); printf (" %s\n", _("Returns UNKNOWN instead of CRITICAL if offset cannot be found")); @@ -610,13 +614,18 @@ void print_help(void){ printf("\n"); printf("%s\n", _("This plugin checks the clock offset between the local host and a")); printf("%s\n", _("remote NTP server. It is independent of any commandline programs or")); - printf("%s\n\n", _("external libraries.")); + printf("%s\n", _("external libraries.")); + printf("\n"); printf("%s\n", _("Notes:")); printf(" %s\n", _("If you'd rather want to monitor an NTP server, please use")); - printf(" %s\n\n", _("check_ntp_peer.")); - + printf(" %s\n", _("check_ntp_peer.")); + printf("\n"); printf(_(UT_THRESHOLDS_NOTES)); +#ifdef NP_EXTRA_OPTS + printf("\n"); + printf(_(UT_EXTRA_OPTS_NOTES)); +#endif printf("\n"); printf("%s\n", _("Examples:")); diff --git a/plugins/check_nwstat.c b/plugins/check_nwstat.c index 3c8d5b9..b4fd3c7 100644 --- a/plugins/check_nwstat.c +++ b/plugins/check_nwstat.c @@ -170,6 +170,9 @@ main(int argc, char **argv) { bindtextdomain (PACKAGE, LOCALEDIR); textdomain (PACKAGE); + /* Parse extra opts if any */ + argv=np_extra_opts(&argc, argv, progname); + if (process_arguments(argc,argv) == ERROR) usage4 (_("Could not parse arguments")); @@ -1607,6 +1610,7 @@ void print_help(void) print_usage(); printf (_(UT_HELP_VRSN)); + printf (_(UT_EXTRA_OPTS)); printf (_(UT_HOST_PORT), 'p', myport); @@ -1674,6 +1678,9 @@ void print_help(void) printf (" %s\n", _("- Values for critical thresholds should be lower than warning thresholds")); printf (" %s\n", _(" when the following variables are checked: VPF, VKF, LTCH, CBUFF, DCB, ")); printf (" %s\n", _(" TCB, LRUS and LRUM.")); +#ifdef NP_EXTRA_OPTS + printf (" -%s", _(UT_EXTRA_OPTS_NOTES)); +#endif printf (_(UT_SUPPORT)); } diff --git a/plugins/check_overcr.c b/plugins/check_overcr.c index 6c3675b..af04d3b 100644 --- a/plugins/check_overcr.c +++ b/plugins/check_overcr.c @@ -99,6 +99,9 @@ main (int argc, char **argv) bindtextdomain (PACKAGE, LOCALEDIR); textdomain (PACKAGE); + /* Parse extra opts if any */ + argv=np_extra_opts (&argc, argv, progname); + if (process_arguments (argc, argv) == ERROR) usage4 (_("Could not parse arguments")); @@ -425,6 +428,7 @@ print_help (void) print_usage (); printf (_(UT_HELP_VRSN)); + printf (_(UT_EXTRA_OPTS)); printf (_(UT_HOST_PORT), 'p', myport); @@ -445,17 +449,22 @@ print_help (void) printf (_(UT_TIMEOUT), DEFAULT_SOCKET_TIMEOUT); printf (_(UT_VERBOSE)); - printf ("\n"); - printf ("%s\n", _("Notes:")); - printf (" %s\n", _("For the available options, the critical threshold value should always be")); - printf (" %s\n\n", _("higher than the warning threshold value, EXCEPT with the uptime variable")); - - printf ("%s\n", _("This plugin requres that Eric Molitors' Over-CR collector daemon be")); + printf ("\n"); + printf ("%s\n", _("This plugin requires that Eric Molitors' Over-CR collector daemon be")); printf ("%s\n", _("running on the remote server.")); printf ("%s\n", _("Over-CR can be downloaded from http://www.molitor.org/overcr")); printf ("%s\n", _("This plugin was tested with version 0.99.53 of the Over-CR collector")); + printf ("\n"); + printf ("%s\n", _("Notes:")); + printf (" %s\n", _("For the available options, the critical threshold value should always be")); + printf (" %s\n", _("higher than the warning threshold value, EXCEPT with the uptime variable")); +#ifdef NP_EXTRA_OPTS + printf ("\n"); + printf (_(UT_EXTRA_OPTS_NOTES)); +#endif + printf (_(UT_SUPPORT)); } diff --git a/plugins/check_pgsql.c b/plugins/check_pgsql.c index c721b07..1a93f6b 100644 --- a/plugins/check_pgsql.c +++ b/plugins/check_pgsql.c @@ -150,6 +150,9 @@ main (int argc, char **argv) bindtextdomain (PACKAGE, LOCALEDIR); textdomain (PACKAGE); + /* Parse extra opts if any */ + argv=np_extra_opts (&argc, argv, progname); + if (process_arguments (argc, argv) == ERROR) usage4 (_("Could not parse arguments")); @@ -412,6 +415,7 @@ print_help (void) print_usage (); printf (_(UT_HELP_VRSN)); + printf (_(UT_EXTRA_OPTS)); printf (_(UT_HOST_PORT), 'P', myport); @@ -447,6 +451,12 @@ print_help (void) printf (" %s\n", _("able to connect to the database without a password. The plugin can also send")); printf (" %s\n", _("a password, but no effort is made to obsure or encrypt the password.")); +#ifdef NP_EXTRA_OPTS + printf ("\n"); + printf ("%s\n", _("Notes:")); + printf (_(UT_EXTRA_OPTS_NOTES)); +#endif + printf (_(UT_SUPPORT)); } diff --git a/plugins/check_ping.c b/plugins/check_ping.c index e22856d..0f3292d 100644 --- a/plugins/check_ping.c +++ b/plugins/check_ping.c @@ -92,6 +92,9 @@ main (int argc, char **argv) addresses = malloc (sizeof(char*) * max_addr); addresses[0] = NULL; + /* Parse extra opts if any */ + argv=np_extra_opts (&argc, argv, progname); + if (process_arguments (argc, argv) == ERROR) usage4 (_("Could not parse arguments")); @@ -564,6 +567,7 @@ print_help (void) print_usage (); printf (_(UT_HELP_VRSN)); + printf (_(UT_EXTRA_OPTS)); printf (_(UT_IPv46)); @@ -592,6 +596,12 @@ print_help (void) printf ("%s\n", _("linking to a traceroute CGI contributed by Ian Cass. The CGI can be found in")); printf ("%s\n", _("the contrib area of the downloads section at http://www.nagios.org/")); +#ifdef NP_EXTRA_OPTS + printf ("\n"); + printf ("%s\n", _("Notes:")); + printf (_(UT_EXTRA_OPTS_NOTES)); +#endif + printf (_(UT_SUPPORT)); } diff --git a/plugins/check_procs.c b/plugins/check_procs.c index 816da1b..875f867 100644 --- a/plugins/check_procs.c +++ b/plugins/check_procs.c @@ -143,6 +143,9 @@ main (int argc, char **argv) asprintf (&metric_name, "PROCS"); metric = METRIC_PROCS; + /* Parse extra opts if any */ + argv=np_extra_opts (&argc, argv, progname); + if (process_arguments (argc, argv) == ERROR) usage4 (_("Could not parse arguments")); @@ -715,13 +718,12 @@ print_help (void) print_usage (); - printf ("%s\n", _("Required Arguments:")); + printf (_(UT_HELP_VRSN)); + printf (_(UT_EXTRA_OPTS)); printf (" %s\n", "-w, --warning=RANGE"); printf (" %s\n", _("Generate warning state if metric is outside this range")); printf (" %s\n", "-c, --critical=RANGE"); printf (" %s\n", _("Generate critical state if metric is outside this range")); - - printf ("%s\n", _("Optional Arguments:")); printf (" %s\n", "-m, --metric=TYPE"); printf (" %s\n", _("Check thresholds against metric. Valid types:")); printf (" %s\n", _("PROCS - number of processes (default)")); @@ -737,7 +739,8 @@ print_help (void) printf (" %s\n", "-v, --verbose"); printf (" %s\n", _("Extra information. Up to 3 verbosity levels")); - printf ("%s\n", "Optional Filters:"); + printf ("\n"); + printf ("%s\n", "Filters:"); printf (" %s\n", "-s, --state=STATUSFLAGS"); printf (" %s\n", _("Only scan for processes that have, in the output of `ps`, one or")); printf (" %s\n", _("more of the status flags you specify (for example R, Z, S, RS,")); @@ -771,6 +774,12 @@ the specified threshold ranges. The process count can be filtered by\n\ process owner, parent process PID, current state (e.g., 'Z'), or may\n\ be the total number of running processes\n\n")); +#ifdef NP_EXTRA_OPTS + printf ("%s\n", _("Notes:")); + printf (_(UT_EXTRA_OPTS_NOTES)); + printf ("\n"); +#endif + printf ("%s\n", _("Examples:")); printf (" %s\n", "check_procs -w 2:2 -c 2:1024 -C portsentry"); printf (" %s\n", _("Warning if not two processes with command name portsentry.")); diff --git a/plugins/check_radius.c b/plugins/check_radius.c index 2afe3c8..7ce820a 100644 --- a/plugins/check_radius.c +++ b/plugins/check_radius.c @@ -149,6 +149,9 @@ main (int argc, char **argv) bindtextdomain (PACKAGE, LOCALEDIR); textdomain (PACKAGE); + /* Parse extra opts if any */ + argv=np_extra_opts (&argc, argv, progname); + if (process_arguments (argc, argv) == ERROR) usage4 (_("Could not parse arguments")); @@ -315,6 +318,7 @@ print_help (void) print_usage (); printf (_(UT_HELP_VRSN)); + printf (_(UT_EXTRA_OPTS)); printf (_(UT_HOST_PORT), 'P', myport); @@ -344,6 +348,12 @@ print_help (void) printf ("%s\n", _("run the plugin at regular predictable intervals. Please be sure that")); printf ("%s\n", _("the password used does not allow access to sensitive system resources.")); +#ifdef NP_EXTRA_OPTS + printf ("\n"); + printf ("%s\n", _("Notes:")); + printf (_(UT_EXTRA_OPTS_NOTES)); +#endif + printf (_(UT_SUPPORT)); } diff --git a/plugins/check_real.c b/plugins/check_real.c index 68a6c1e..d333c2a 100644 --- a/plugins/check_real.c +++ b/plugins/check_real.c @@ -77,6 +77,9 @@ main (int argc, char **argv) bindtextdomain (PACKAGE, LOCALEDIR); textdomain (PACKAGE); + /* Parse extra opts if any */ + argv=np_extra_opts (&argc, argv, progname); + if (process_arguments (argc, argv) == ERROR) usage4 (_("Could not parse arguments")); @@ -418,6 +421,7 @@ print_help (void) print_usage (); printf (_(UT_HELP_VRSN)); + printf (_(UT_EXTRA_OPTS)); printf (_(UT_HOST_PORT), 'p', myport); @@ -440,6 +444,12 @@ print_help (void) printf ("%s\n", _("but incorrect reponse messages from the host result in STATE_WARNING return")); printf ("%s\n", _("values.")); +#ifdef NP_EXTRA_OPTS + printf ("\n"); + printf ("%s\n", _("Notes:")); + printf (_(UT_EXTRA_OPTS_NOTES)); +#endif + printf (_(UT_SUPPORT)); } diff --git a/plugins/check_smtp.c b/plugins/check_smtp.c index b1fc7ee..8ff10b8 100644 --- a/plugins/check_smtp.c +++ b/plugins/check_smtp.c @@ -137,6 +137,9 @@ main (int argc, char **argv) bindtextdomain (PACKAGE, LOCALEDIR); textdomain (PACKAGE); + /* Parse extra opts if any */ + argv=np_extra_opts (&argc, argv, progname); + if (process_arguments (argc, argv) == ERROR) usage4 (_("Could not parse arguments")); @@ -771,6 +774,7 @@ print_help (void) print_usage (); printf (_(UT_HELP_VRSN)); + printf (_(UT_EXTRA_OPTS)); printf (_(UT_HOST_PORT), 'p', myport); @@ -812,6 +816,12 @@ print_help (void) printf ("%s\n", _("connects, but incorrect reponse messages from the host result in")); printf ("%s\n", _("STATE_WARNING return values.")); +#ifdef NP_EXTRA_OPTS + printf ("\n"); + printf ("%s\n", _("Notes:")); + printf (_(UT_EXTRA_OPTS_NOTES)); +#endif + printf (_(UT_SUPPORT)); } diff --git a/plugins/check_snmp.c b/plugins/check_snmp.c index b943565..0acade2 100644 --- a/plugins/check_snmp.c +++ b/plugins/check_snmp.c @@ -176,6 +176,9 @@ main (int argc, char **argv) timeout_interval = DEFAULT_TIMEOUT; retries = DEFAULT_RETRIES; + /* Parse extra opts if any */ + argv=np_extra_opts (&argc, argv, progname); + if (process_arguments (argc, argv) == ERROR) usage4 (_("Could not parse arguments")); @@ -932,6 +935,7 @@ print_help (void) print_usage (); printf (_(UT_HELP_VRSN)); + printf (_(UT_EXTRA_OPTS)); printf (_(UT_HOST_PORT), 'p', DEFAULT_PORT); @@ -1017,6 +1021,9 @@ print_help (void) printf (" %s\n", _("- Note that only one string and one regex may be checked at present")); printf (" %s\n", _("- All evaluation methods other than PR, STR, and SUBSTR expect that the value")); printf (" %s\n", _("returned from the SNMP query is an unsigned integer.")); +#ifdef NP_EXTRA_OPTS + printf (" -%s", _(UT_EXTRA_OPTS_NOTES)); +#endif printf (_(UT_SUPPORT)); } diff --git a/plugins/check_ssh.c b/plugins/check_ssh.c index 869b803..4b5f6b7 100644 --- a/plugins/check_ssh.c +++ b/plugins/check_ssh.c @@ -70,6 +70,9 @@ main (int argc, char **argv) bindtextdomain (PACKAGE, LOCALEDIR); textdomain (PACKAGE); + /* Parse extra opts if any */ + argv=np_extra_opts (&argc, argv, progname); + if (process_arguments (argc, argv) == ERROR) usage4 (_("Could not parse arguments")); @@ -281,6 +284,7 @@ print_help (void) print_usage (); printf (_(UT_HELP_VRSN)); + printf (_(UT_EXTRA_OPTS)); printf (_(UT_HOST_PORT), 'p', myport); @@ -293,6 +297,12 @@ print_help (void) printf (_(UT_VERBOSE)); +#ifdef NP_EXTRA_OPTS + printf ("\n"); + printf ("%s\n", _("Notes:")); + printf (_(UT_EXTRA_OPTS_NOTES)); +#endif + printf (_(UT_SUPPORT)); } diff --git a/plugins/check_swap.c b/plugins/check_swap.c index 1c627ac..04cc1ae 100644 --- a/plugins/check_swap.c +++ b/plugins/check_swap.c @@ -107,6 +107,9 @@ main (int argc, char **argv) status = strdup (""); + /* Parse extra opts if any */ + argv=np_extra_opts (&argc, argv, progname); + if (process_arguments (argc, argv) == ERROR) usage4 (_("Could not parse arguments")); @@ -530,6 +533,7 @@ print_help (void) print_usage (); printf (_(UT_HELP_VRSN)); + printf (_(UT_EXTRA_OPTS)); printf (" %s\n", "-w, --warning=INTEGER"); printf (" %s\n", _("Exit with WARNING status if less than INTEGER bytes of swap space are free")); @@ -546,6 +550,11 @@ print_help (void) printf ("\n"); printf ("%s\n", _("Notes:")); printf (" %s\n", _("On AIX, if -a is specified, uses lsps -a, otherwise uses lsps -s.")); +#ifdef NP_EXTRA_OPTS + printf ("\n"); + printf (_(UT_EXTRA_OPTS_NOTES)); +#endif + printf (_(UT_SUPPORT)); } diff --git a/plugins/check_tcp.c b/plugins/check_tcp.c index d74b5a8..3ad3131 100644 --- a/plugins/check_tcp.c +++ b/plugins/check_tcp.c @@ -205,6 +205,9 @@ main (int argc, char **argv) server_quit = QUIT; status = NULL; + /* Parse extra opts if any */ + argv=np_extra_opts (&argc, argv, progname); + if (process_arguments (argc, argv) == ERROR) usage4 (_("Could not parse arguments")); @@ -602,6 +605,7 @@ print_help (void) print_usage (); printf (_(UT_HELP_VRSN)); + printf (_(UT_EXTRA_OPTS)); printf (_(UT_HOST_PORT), 'p', "none"); @@ -642,6 +646,12 @@ print_help (void) printf (_(UT_VERBOSE)); +#ifdef NP_EXTRA_OPTS + printf ("\n"); + printf ("%s\n", _("Notes:")); + printf (_(UT_EXTRA_OPTS_NOTES)); +#endif + printf (_(UT_SUPPORT)); } diff --git a/plugins/check_time.c b/plugins/check_time.c index acfc3ef..b6d9e38 100644 --- a/plugins/check_time.c +++ b/plugins/check_time.c @@ -75,6 +75,9 @@ main (int argc, char **argv) bindtextdomain (PACKAGE, LOCALEDIR); textdomain (PACKAGE); + /* Parse extra opts if any */ + argv=np_extra_opts (&argc, argv, progname); + if (process_arguments (argc, argv) == ERROR) usage4 (_("Could not parse arguments")); @@ -344,6 +347,7 @@ print_help (void) print_usage (); printf (_(UT_HELP_VRSN)); + printf (_(UT_EXTRA_OPTS)); printf (_(UT_HOST_PORT), 'p', myport); @@ -359,6 +363,13 @@ print_help (void) printf (" %s\n", _("Response time (sec.) necessary to result in critical status")); printf (_(UT_TIMEOUT), DEFAULT_SOCKET_TIMEOUT); + +#ifdef NP_EXTRA_OPTS + printf ("\n"); + printf ("%s\n", _("Notes:")); + printf (_(UT_EXTRA_OPTS_NOTES)); +#endif + printf (_(UT_SUPPORT)); } diff --git a/plugins/check_ups.c b/plugins/check_ups.c index 666485e..773da5f 100644 --- a/plugins/check_ups.c +++ b/plugins/check_ups.c @@ -119,6 +119,9 @@ main (int argc, char **argv) data = strdup (""); message = strdup (""); + /* Parse extra opts if any */ + argv=np_extra_opts (&argc, argv, progname); + if (process_arguments (argc, argv) == ERROR) usage4 (_("Could not parse arguments")); @@ -609,6 +612,7 @@ print_help (void) print_usage (); printf (_(UT_HELP_VRSN)); + printf (_(UT_EXTRA_OPTS)); printf (_(UT_HOST_PORT), 'p', myport); @@ -640,12 +644,15 @@ print_help (void) printf (" %s\n", _("battery load, etc.) as well as warning and critical thresholds for the value")); printf (" %s\n", _("of that variable. If the remote host has multiple UPS that are being monitored")); printf (" %s\n", _("you will have to use the --ups option to specify which UPS to check.")); - printf ("\n"); printf (" %s\n", _("This plugin requires that the UPSD daemon distributed with Russel Kroll's")); printf (" %s\n", _("Smart UPS Tools be installed on the remote host. If you do not have the")); printf (" %s\n", _("package installed on your system, you can download it from")); printf (" %s\n", _("http://www.networkupstools.org")); +#ifdef NP_EXTRA_OPTS + printf ("\n"); + printf (_(UT_EXTRA_OPTS_NOTES)); +#endif printf (_(UT_SUPPORT)); } diff --git a/plugins/check_users.c b/plugins/check_users.c index c81822b..e4ef681 100644 --- a/plugins/check_users.c +++ b/plugins/check_users.c @@ -65,6 +65,9 @@ main (int argc, char **argv) perf = strdup(""); + /* Parse extra opts if any */ + argv=np_extra_opts (&argc, argv, progname); + if (process_arguments (argc, argv) == ERROR) usage4 (_("Could not parse arguments")); @@ -213,12 +216,19 @@ print_help (void) print_usage (); printf (_(UT_HELP_VRSN)); + printf (_(UT_EXTRA_OPTS)); printf (" %s\n", "-w, --warning=INTEGER"); printf (" %s\n", _("Set WARNING status if more than INTEGER users are logged in")); printf (" %s\n", "-c, --critical=INTEGER"); printf (" %s\n", _("Set CRITICAL status if more than INTEGER users are logged in")); +#ifdef NP_EXTRA_OPTS + printf ("\n"); + printf ("%s\n", _("Notes:")); + printf (_(UT_EXTRA_OPTS_NOTES)); +#endif + printf (_(UT_SUPPORT)); } diff --git a/plugins/utils.h b/plugins/utils.h index def8970..67e099d 100644 --- a/plugins/utils.h +++ b/plugins/utils.h @@ -16,6 +16,14 @@ suite of plugins. */ /* now some functions etc are being defined in ../lib/utils_base.c */ #include "utils_base.h" +#ifdef NP_EXTRA_OPTS +/* Include extra-opts functions if compiled in */ +#include "extra_opts.h" +#else +/* else, fake np_extra_opts */ +#define np_extra_opts(acptr,av,pr) av +#endif + /* Standardize version information, termination */ /* $Id$ */ @@ -173,6 +181,17 @@ char *fperfdata (const char *, -t, --timeout=INTEGER\n\ Seconds before connection times out (default: %d)\n" +#ifdef NP_EXTRA_OPTS +#define UT_EXTRA_OPTS "\ + --extra-opts=[section][@file]\n\ + Read additionnal options from ini file\n" +#define UT_EXTRA_OPTS_NOTES "\ + See: http://nagiosplugins.org/extra-opts for --extra-opts usage and examples.\n" +#else +#define UT_EXTRA_OPTS "" +#define UT_EXTRA_OPTS_NOTES "" +#endif + #define UT_THRESHOLDS_NOTES "\ See:\n\ http://nagiosplug.sourceforge.net/developer-guidelines.html#THRESHOLDFORMAT\n\ -- cgit v0.10-9-g596f