Code

Add missing long options for check_nt (for use with extra-opts)
[nagiosplug.git] / plugins / check_nt.c
index 60d58fd09e33b58f2e265c259584c7889ea28b6a..a0e5c11927b40c22c90b8bdf073dc7578083a355 100644 (file)
@@ -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"));
 
@@ -157,7 +160,7 @@ int main(int argc, char **argv){
                        return_code=STATE_OK;
                        temp_string = strdup (_("CPU Load"));
                        temp_string_perf = strdup (" ");
-      
+
                        /* loop until one of the parameters is wrong or not present */
                        while (lvalue_list[0+offset]> (unsigned long)0 &&
                                                 lvalue_list[0+offset]<=(unsigned long)17280 && 
@@ -185,7 +188,7 @@ int main(int argc, char **argv){
                                asprintf(&temp_string_perf,"%s%s",temp_string_perf,perfdata);
                                offset+=3;      /* move across the array */
                        }
-      
+
                        if (strlen(temp_string)>10) {  /* we had at least one loop */
                                output_message = strdup (temp_string);
                                perfdata = temp_string_perf;
@@ -473,6 +476,9 @@ int process_arguments(int argc, char **argv){
                {"warning",  required_argument,0,'w'},
                {"variable", required_argument,0,'v'},
                {"hostname", required_argument,0,'H'},
+               {"params",   required_argument,0,'l'},
+               {"secret",   required_argument,0,'s'},
+               {"display",  required_argument,0,'d'},
                {"version",  no_argument,      0,'V'},
                {"help",     no_argument,      0,'h'},
                {0,0,0,0}
@@ -640,18 +646,19 @@ void print_help(void)
   printf ("%s\n", _("Windows NT/2000/XP/2003 server."));
 
   printf ("\n\n");
-  
+
        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");
   printf ("   %s", _("Optional port number (default: "));
   printf ("%d)\n", PORT);
-  printf (" %s\n", "-s <password>");
+  printf (" %s\n", "-s, --secret=<password>");
   printf ("   %s\n", _("Password needed for the request"));
   printf (" %s\n", "-w, --warning=INTEGER");
   printf ("   %s\n", _("Threshold which will result in a warning status"));
@@ -659,6 +666,10 @@ void print_help(void)
   printf ("   %s\n", _("Threshold which will result in a critical status"));
   printf (" %s\n", "-t, --timeout=INTEGER");
   printf ("   %s", _("Seconds before connection attempt times out (default: "));
+  printf (" %s\n", "-l, --params=<parameters>");
+  printf ("   %s", _("Parameters passed to specified check (see below)"));
+  printf (" %s\n", "-d, --display={SHOWALL}");
+  printf ("   %s", _("Display options (currently only SHOWALL works)"));
   printf ("%d)\n", DEFAULT_SOCKET_TIMEOUT);
   printf (" %s\n", "-h, --help");
   printf ("   %s\n", _("Print this help screen"));
@@ -720,14 +731,20 @@ void print_help(void)
   printf ("  %s\n", _(" configuration files."));
   printf ("  %s\n", _("Some examples:"));
   printf ("  %s\n\n", _("check_nt -H 192.168.1.1 -p 1248 -v INSTANCES -l Process"));
-  printf (_("Notes:"));
+
+  printf ("%s\n", _("Notes:"));
   printf (" %s\n", _("- The NSClient service should be running on the server to get any information"));
-  printf (" %s\n", "(http://nsclient.ready2run.nl).");
+  printf ("   %s\n", "(http://nsclient.ready2run.nl).");
   printf (" %s\n", _("- Critical thresholds should be lower than warning thresholds"));
   printf (" %s\n", _("- Default port 1248 is sometimes in use by other services. The error"));
-  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."));
+  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));
 }
 
 
@@ -735,6 +752,6 @@ void print_help(void)
 void print_usage(void)
 {
   printf (_("Usage:"));
-       printf ("%s -H host -v variable [-p port] [-w warning] [-c critical]",progname);
+       printf ("%s -H host -v variable [-p port] [-w warning] [-c critical]\n",progname);
   printf ("[-l params] [-d SHOWALL] [-t timeout]\n");
 }