Code

return of process_arguments() is TRUE not OK !
[nagiosplug.git] / plugins / check_nt.c
1 /******************************************************************************
2  *
3  * CHECK_NT.C
4  *
5  * Program: Windows NT plugin for Nagios
6  * License: GPL
7  * Copyright (c) 2000-2002 Yves Rubin (rubiyz@yahoo.com)
8  *
9  * Description:
10  * 
11  * This requires NSClient software to run on NT (http://nsclient.ready2run.nl/)
12  *
13  * License Information:
14  *
15  * This program is free software; you can redistribute it and/or modify
16  * it under the terms of the GNU General Public License as published by
17  * the Free Software Foundation; either version 2 of the License, or
18  * (at your option) any later version.
19  *
20  * This program is distributed in the hope that it will be useful,
21  * but WITHOUT ANY WARRANTY; without even the implied warranty of
22  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
23  * GNU General Public License for more details.
24  *
25  * You should have received a copy of the GNU General Public License
26  * along with this program; if not, write to the Free Software
27  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
28  *
29  * $Id$
30  *
31  *****************************************************************************/
33 #include "common.h"
34 #include "netutils.h"
35 #include "utils.h"
37 enum checkvars {
38         CHECK_NONE,
39         CHECK_CLIENTVERSION,
40         CHECK_CPULOAD,
41         CHECK_UPTIME,
42         CHECK_USEDDISKSPACE,
43         CHECK_SERVICESTATE,
44         CHECK_PROCSTATE,
45         CHECK_MEMUSE,
46         CHECK_COUNTER,
47         CHECK_FILEAGE
48 };
50 enum {
51         MAX_VALUE_LIST = 30,
52         PORT = 1248
53 };
55 char *server_address=NULL;
56 char *volume_name=NULL;
57 int server_port=PORT;
58 char *value_list=NULL;
59 char *req_password=NULL;
60 unsigned long lvalue_list[MAX_VALUE_LIST];
61 unsigned long warning_value=0L;
62 unsigned long critical_value=0L;
63 int check_warning_value=FALSE;
64 int check_critical_value=FALSE;
65 enum checkvars vars_to_check = CHECK_NONE;
66 int show_all=FALSE;
68 const char *progname = "check_nt";
70 char recv_buffer[MAX_INPUT_BUFFER];
72 void fetch_data (const char* address, int port, const char* sendb);
73 int process_arguments(int, char **);
74 void preparelist(char *string);
75 int strtoularray(unsigned long *array, char *string, const char *delim);
76 void print_help(void);
77 void print_usage(void);
79 int main(int argc, char **argv){
80         int return_code = STATE_UNKNOWN;
81         char *send_buffer=NULL;
82         char *output_message=NULL;
83         char *perfdata=NULL;
84         char *temp_string=NULL;
85         char *temp_string_perf=NULL;
86         char *description=NULL,*counter_unit = NULL;
87         char *minval = NULL, *maxval = NULL, *errcvt = NULL;
89         double total_disk_space=0;
90         double free_disk_space=0;
91         double percent_used_space=0;
92         double warning_used_space=0;
93         double critical_used_space=0;
94         double mem_commitLimit=0;
95         double mem_commitByte=0;
96         double fminval = 0, fmaxval = 0;
97         unsigned long utilization;
98         unsigned long uptime;
99         unsigned long age_in_minutes;
100         double counter_value;
101         int offset=0;
102         int updays=0;
103         int uphours=0;
104         int upminutes=0;
106         int isPercent = FALSE;
107         int allRight = FALSE;
109         setlocale (LC_ALL, "");
110         bindtextdomain (PACKAGE, LOCALEDIR);
111         textdomain (PACKAGE);
113         if(process_arguments(argc,argv) != TRUE)
114                 usage (_("check_nt: could not parse arguments\n"));
116         /* initialize alarm signal handling */
117         signal(SIGALRM,socket_timeout_alarm_handler);
119         /* set socket timeout */
120         alarm(socket_timeout);
122         switch (vars_to_check) {
124         case CHECK_CLIENTVERSION:
126                 asprintf(&send_buffer, "%s&1", req_password);
127                 fetch_data (server_address, server_port, send_buffer);
128                 if (value_list != NULL && strcmp(recv_buffer, value_list) != 0) {
129                         asprintf (&output_message, _("Wrong client version - running: %s, required: %s"), recv_buffer, value_list);
130                         return_code = STATE_WARNING;
131                 } else {
132                         asprintf (&output_message, "%s", recv_buffer);
133                         return_code = STATE_OK;
134                 }
135                 break;
137         case CHECK_CPULOAD:
139                 if (value_list==NULL)
140                         output_message = strdup (_("missing -l parameters"));
141                 else if (strtoularray(lvalue_list,value_list,",")==FALSE)
142                         output_message = strdup (_("wrong -l parameter."));
143                 else {
144                         /* -l parameters is present with only integers */
145                         return_code=STATE_OK;
146                         temp_string = strdup (_("CPU Load"));
147                         temp_string_perf = strdup (" ");
148       
149                         /* loop until one of the parameters is wrong or not present */
150                         while (lvalue_list[0+offset]> (unsigned long)0 &&
151                                                  lvalue_list[0+offset]<=(unsigned long)17280 && 
152                                                  lvalue_list[1+offset]> (unsigned long)0 &&
153                                                  lvalue_list[1+offset]<=(unsigned long)100 && 
154                                                  lvalue_list[2+offset]> (unsigned long)0 &&
155                                                  lvalue_list[2+offset]<=(unsigned long)100) {
157                                 /* Send request and retrieve data */
158                                 asprintf(&send_buffer,"%s&2&%lu",req_password,lvalue_list[0+offset]);
159                                 fetch_data (server_address, server_port, send_buffer);
161                                 utilization=strtoul(recv_buffer,NULL,10);
162                                 
163                                 /* Check if any of the request is in a warning or critical state */
164                                 if(utilization >= lvalue_list[2+offset])
165                                         return_code=STATE_CRITICAL;
166                                 else if(utilization >= lvalue_list[1+offset] && return_code<STATE_WARNING)
167                                         return_code=STATE_WARNING;
169                                 asprintf(&output_message,_(" %lu%% (%lu min average)"), utilization, lvalue_list[0+offset]);
170                                 asprintf(&temp_string,"%s%s",temp_string,output_message);
171                                 asprintf(&perfdata,_(" '%lu min avg Load'=%lu%%;%lu;%lu;0;100"), lvalue_list[0+offset], utilization,
172                                   lvalue_list[1+offset], lvalue_list[2+offset]);
173                                 asprintf(&temp_string_perf,"%s%s",temp_string_perf,perfdata);
174                                 offset+=3;      /* move across the array */
175                         }
176       
177                         if (strlen(temp_string)>10) {  /* we had at least one loop */
178                                 output_message = strdup (temp_string);
179                                 perfdata = temp_string_perf;
180                         } else
181                                 output_message = strdup (_("not enough values for -l parameters"));
182                 }       
183                 break;
185         case CHECK_UPTIME:
187                 asprintf(&send_buffer, "%s&3", req_password);
188                 fetch_data (server_address, server_port, send_buffer);
189                 uptime=strtoul(recv_buffer,NULL,10);
190                 updays = uptime / 86400;                        
191                 uphours = (uptime % 86400) / 3600;
192                 upminutes = ((uptime % 86400) % 3600) / 60;
193                 asprintf(&output_message,_("System Uptime - %u day(s) %u hour(s) %u minute(s)"),updays,uphours, upminutes);
194                 return_code=STATE_OK;
195                 break;
197         case CHECK_USEDDISKSPACE:
199                 if (value_list==NULL)
200                         output_message = strdup (_("missing -l parameters"));
201                 else if (strlen(value_list)!=1)
202                         output_message = strdup (_("wrong -l argument"));
203                 else {
204                         asprintf(&send_buffer,"%s&4&%s", req_password, value_list);
205                         fetch_data (server_address, server_port, send_buffer);
206                         free_disk_space=atof(strtok(recv_buffer,"&"));
207                         total_disk_space=atof(strtok(NULL,"&"));
208                         percent_used_space = ((total_disk_space - free_disk_space) / total_disk_space) * 100;
209                         warning_used_space = ((float)warning_value / 100) * total_disk_space;
210                         critical_used_space = ((float)critical_value / 100) * total_disk_space;
212                         if (free_disk_space>=0) {
213                                 asprintf(&temp_string,_("%s:\\ - total: %.2f Gb - used: %.2f Gb (%.0f%%) - free %.2f Gb (%.0f%%)"),
214                                   value_list, total_disk_space / 1073741824, (total_disk_space - free_disk_space) / 1073741824,
215                                   percent_used_space, free_disk_space / 1073741824, (free_disk_space / total_disk_space)*100);
216                                 asprintf(&temp_string_perf,_("'%s:\\ Used Space'=%.2fGb;%.2f;%.2f;0.00;%.2f"), value_list,
217                                   (total_disk_space - free_disk_space) / 1073741824, warning_used_space / 1073741824,
218                                   critical_used_space / 1073741824, total_disk_space / 1073741824);
220                                 if(check_critical_value==TRUE && percent_used_space >= critical_value)
221                                         return_code=STATE_CRITICAL;
222                                 else if (check_warning_value==TRUE && percent_used_space >= warning_value)
223                                         return_code=STATE_WARNING;      
224                                 else
225                                         return_code=STATE_OK;   
227                                 output_message = strdup (temp_string);
228                                 perfdata = temp_string_perf;
229                         } else {
230                                 output_message = strdup (_("Free disk space : Invalid drive "));
231                                 return_code=STATE_UNKNOWN;
232                         }
233                 }
234                 break;
236         case CHECK_SERVICESTATE:
237         case CHECK_PROCSTATE:
239                 if (value_list==NULL)
240                         output_message = strdup (_("No service/process specified"));
241                 else {
242                         preparelist(value_list);                /* replace , between services with & to send the request */
243                         asprintf(&send_buffer,"%s&%u&%s&%s", req_password,(vars_to_check==CHECK_SERVICESTATE)?5:6,
244                                                          (show_all==TRUE) ? "ShowAll" : "ShowFail",value_list);
245                         fetch_data (server_address, server_port, send_buffer);
246                         return_code=atoi(strtok(recv_buffer,"&"));
247                         temp_string=strtok(NULL,"&");
248                         output_message = strdup (temp_string);
249                 }
250                 break;
252         case CHECK_MEMUSE:
253                 
254                 asprintf(&send_buffer,"%s&7", req_password);
255                 fetch_data (server_address, server_port, send_buffer);
256                 mem_commitLimit=atof(strtok(recv_buffer,"&"));
257                 mem_commitByte=atof(strtok(NULL,"&"));
258                 percent_used_space = (mem_commitByte / mem_commitLimit) * 100;
259                 warning_used_space = ((float)warning_value / 100) * mem_commitLimit;
260                 critical_used_space = ((float)critical_value / 100) * mem_commitLimit;
262                 /* Divisor should be 1048567, not 3044515, as we are measuring "Commit Charge" here, 
263                 which equals RAM + Pagefiles. */
264                 asprintf(&output_message,_("Memory usage: total:%.2f Mb - used: %.2f Mb (%.0f%%) - free: %.2f Mb (%.0f%%)"), 
265                   mem_commitLimit / 1048567, mem_commitByte / 1048567, percent_used_space,  
266                   (mem_commitLimit - mem_commitByte) / 1048567, (mem_commitLimit - mem_commitByte) / mem_commitLimit * 100);
267                 asprintf(&perfdata,_("'Memory usage'=%.2fMb;%.2f;%.2f;0.00;%.2f"), mem_commitByte / 1048567,
268                   warning_used_space / 1048567, critical_used_space / 1048567, mem_commitLimit / 1048567);
269         
270                 return_code=STATE_OK;
271                 if(check_critical_value==TRUE && percent_used_space >= critical_value)
272                         return_code=STATE_CRITICAL;
273                 else if (check_warning_value==TRUE && percent_used_space >= warning_value)
274                         return_code=STATE_WARNING;      
276                 break;
278         case CHECK_COUNTER:
281                 /* 
282                 CHECK_COUNTER has been modified to provide extensive perfdata information.
283                 In order to do this, some modifications have been done to the code
284                 and some constraints have been introduced.
285                 
286                 1) For the sake of simplicity of the code, perfdata information will only be 
287                  provided when the "description" field is added. 
288                 
289                 2) If the counter you're going to measure is percent-based, the code will detect
290                  the percent sign in its name and will attribute minimum (0%) and maximum (100%) 
291                  values automagically, as well the ĀØ%" sign to graph units.
293                 3) OTOH, if the counter is "absolute", you'll have to provide the following
294                  the counter unit - that is, the dimensions of the counter you're getting. Examples:
295                  pages/s, packets transferred, etc.
297                 4) If you want, you may provide the minimum and maximum values to expect. They aren't mandatory,
298                  but once specified they MUST have the same order of magnitude and units of -w and -c; otherwise.
299                  strange things will happen when you make graphs of your data.
300                 */
302                 if (value_list == NULL)
303                         output_message = strdup (_("No counter specified"));
304                 else
305                 {
306                         preparelist (value_list);       /* replace , between services with & to send the request */
307                         isPercent = (strchr (value_list, '%') != NULL);
309                         strtok (value_list, "&");       /* burn the first parameters */
310                         description = strtok (NULL, "&");
311                         counter_unit = strtok (NULL, "&");
312                         asprintf (&send_buffer, "%s&8&%s", req_password, value_list);
313                         fetch_data (server_address, server_port, send_buffer);
314                         counter_value = atof (recv_buffer);
317                         if (description == NULL)
318                         asprintf (&output_message, "%.f", counter_value);
319                         else if (isPercent)
320                              {  
321                                 counter_unit = strdup ("%");
322                                 allRight = TRUE;
323                              }
325                         if ((counter_unit != NULL) && (!allRight))
326                         {       
327                                 minval = strtok (NULL, "&");
328                                 maxval = strtok (NULL, "&");
330                                 /* All parameters specified. Let's check the numbers */
332                                 fminval = (minval != NULL) ? strtod (minval, &errcvt) : -1;
333                                 fmaxval = (minval != NULL) ? strtod (maxval, &errcvt) : -1;
335                                 if ((fminval == 0) && (minval == errcvt))
336                                         output_message = strdup (_("Minimum value contains non-numbers"));
337                                 else
338                                 {
339                                         if ((fmaxval == 0) && (maxval == errcvt))
340                                                 output_message = strdup (_("Maximum value contains non-numbers"));
341                                         else
342                                                 allRight = TRUE;        /* Everything is OK. */
344                                 }
345                         }
346                         else if ((counter_unit == NULL) && (description != NULL))
347                                 output_message = strdup (_("No unit counter specified"));
349                         if (allRight)
350                         {
351                                 /* Let's format the output string, finally... */
353                                 asprintf (&output_message, "%s = %.2f %s", description, counter_value, counter_unit);
354                                 output_message = strcat (output_message, "|");
355                                 output_message = strcat (output_message,
356                                                         fperfdata (description, counter_value, counter_unit,
357                                                                    1, warning_value, 1, critical_value,
358                                                                    (!(isPercent) && (minval != NULL)), fminval,
359                                                                    (!(isPercent) && (minval != NULL)), fmaxval));
360                         }
361                 }
363                 if (critical_value > warning_value)
364                 {                       /* Normal thresholds */
365                         if (check_critical_value == TRUE && counter_value >= critical_value)
366                              return_code = STATE_CRITICAL;
367                         else if (check_warning_value == TRUE && counter_value >= warning_value)
368                                 return_code = STATE_WARNING;
369                              else
370                                 return_code = STATE_OK;
371                 }
372                 else
373                 {                       /* inverse thresholds */
374                         return_code = STATE_OK;
375                         if (check_critical_value == TRUE && counter_value <= critical_value)
376                              return_code = STATE_CRITICAL;
377                         else if (check_warning_value == TRUE && counter_value <= warning_value)
378                                     return_code = STATE_WARNING;
379                 }
380         break;
381                 
382         case CHECK_FILEAGE:
384                 if (value_list==NULL)
385                         output_message = strdup (_("No counter specified"));
386                 else {
387                         preparelist(value_list);                /* replace , between services with & to send the request */
388                         asprintf(&send_buffer,"%s&9&%s", req_password,value_list);
389                         fetch_data (server_address, server_port, send_buffer);
390                         age_in_minutes = atoi(strtok(recv_buffer,"&"));
391                         description = strtok(NULL,"&");
392                         output_message = strdup (description);
393         
394                         if (critical_value > warning_value) {        /* Normal thresholds */
395                                 if(check_critical_value==TRUE && age_in_minutes >= critical_value)
396                                         return_code=STATE_CRITICAL;
397                                 else if (check_warning_value==TRUE && age_in_minutes >= warning_value)
398                                         return_code=STATE_WARNING;      
399                                 else
400                                         return_code=STATE_OK;   
401                         } 
402                         else {                                       /* inverse thresholds */
403                                 if(check_critical_value==TRUE && age_in_minutes <= critical_value)
404                                         return_code=STATE_CRITICAL;
405                                 else if (check_warning_value==TRUE && age_in_minutes <= warning_value)
406                                         return_code=STATE_WARNING;      
407                                 else
408                                         return_code=STATE_OK;   
409                         }
410                 }
411                 break;
413         case CHECK_NONE:
414         default:
415                 usage (_("Please specify a variable to check"));
416                 break;
418         }
420         /* reset timeout */
421         alarm(0);
423         if (perfdata==NULL)
424                 printf("%s\n",output_message);
425         else
426                 printf("%s | %s\n",output_message,perfdata);
427         return return_code;
432 /* process command-line arguments */
433 int process_arguments(int argc, char **argv){
434         int c;
436         int option = 0;
437         static struct option longopts[] =
438         { 
439                 {"port",     required_argument,0,'p'},
440                 {"timeout",  required_argument,0,'t'},
441                 {"critical", required_argument,0,'c'},
442                 {"warning",  required_argument,0,'w'},
443                 {"variable", required_argument,0,'v'},
444                 {"hostname", required_argument,0,'H'},
445                 {"version",  no_argument,      0,'V'},
446                 {"help",     no_argument,      0,'h'},
447                 {0,0,0,0}
448         };
450         /* no options were supplied */
451         if(argc<2) return ERROR;
453         /* backwards compatibility */
454         if (! is_option(argv[1])) {
455                 server_address = strdup(argv[1]);
456                 argv[1]=argv[0];
457                 argv=&argv[1];
458                 argc--;
459         }
461   for (c=1;c<argc;c++) {
462     if(strcmp("-to",argv[c])==0)
463       strcpy(argv[c],"-t");
464     else if (strcmp("-wv",argv[c])==0)
465       strcpy(argv[c],"-w");
466     else if (strcmp("-cv",argv[c])==0)
467       strcpy(argv[c],"-c");
468         }
470         while (1){
471                 c = getopt_long(argc,argv,"+hVH:t:c:w:p:v:l:s:d:",longopts,&option);
473                 if (c==-1||c==EOF||c==1)
474                         break;
476                 switch (c)
477                         {
478                         case '?': /* print short usage statement if args not parsable */
479                                 printf("%s: Unknown argument: %s\n\n",progname,optarg);
480                                 print_usage();
481                                 exit(STATE_UNKNOWN);
482                         case 'h': /* help */
483                                 print_help();
484                                 exit(STATE_OK);
485                         case 'V': /* version */
486                                 print_revision(progname,"$Revision$");
487                                 exit(STATE_OK);
488                         case 'H': /* hostname */
489                                 if (server_address)     free(server_address);
490                                 server_address = optarg;
491                                 break;
492                         case 's': /* password */
493                                 req_password = optarg;
494                                 break;
495                         case 'p': /* port */
496                                 if (is_intnonneg(optarg))
497                                         server_port=atoi(optarg);
498                                 else
499                                         die(STATE_UNKNOWN,_("Server port an integer (seconds)\nType '%s -h' for additional help\n"),progname);
500                                 break;
501                         case 'v':
502                                 if(strlen(optarg)<4)
503                                         return ERROR;
504                                 if(!strcmp(optarg,"CLIENTVERSION"))
505                                         vars_to_check=CHECK_CLIENTVERSION;
506                                 else if(!strcmp(optarg,"CPULOAD"))
507                                         vars_to_check=CHECK_CPULOAD;
508                                 else if(!strcmp(optarg,"UPTIME"))
509                                         vars_to_check=CHECK_UPTIME;
510                                 else if(!strcmp(optarg,"USEDDISKSPACE"))
511                                         vars_to_check=CHECK_USEDDISKSPACE;
512                                 else if(!strcmp(optarg,"SERVICESTATE"))
513                                         vars_to_check=CHECK_SERVICESTATE;
514                                 else if(!strcmp(optarg,"PROCSTATE"))
515                                         vars_to_check=CHECK_PROCSTATE;
516                                 else if(!strcmp(optarg,"MEMUSE"))
517                                         vars_to_check=CHECK_MEMUSE;
518                                 else if(!strcmp(optarg,"COUNTER"))
519                                         vars_to_check=CHECK_COUNTER;
520                                 else if(!strcmp(optarg,"FILEAGE"))
521                                         vars_to_check=CHECK_FILEAGE;
522                                 else
523                                         return ERROR;
524                                 break;
525                         case 'l': /* value list */
526                                 value_list = optarg;
527                                 break;
528                         case 'w': /* warning threshold */
529                                 warning_value=strtoul(optarg,NULL,10);
530                                 check_warning_value=TRUE;
531                                 break;
532                         case 'c': /* critical threshold */
533                                 critical_value=strtoul(optarg,NULL,10);
534                                 check_critical_value=TRUE;
535                                 break;
536                         case 'd': /* Display select for services */
537                                 if (!strcmp(optarg,"SHOWALL"))
538                                         show_all = TRUE;
539                                 break;
540                         case 't': /* timeout */
541                                 socket_timeout=atoi(optarg);
542                                 if(socket_timeout<=0)
543                                         return ERROR;
544                         }
546         }
548         if (vars_to_check==CHECK_NONE)
549                 return ERROR;
551         if (req_password == NULL)
552                 req_password = strdup (_("None"));
554         return OK;
559 void fetch_data (const char *address, int port, const char *sendb) {
560         int result;
562         result=process_tcp_request(address, port, sendb, recv_buffer,sizeof(recv_buffer));
564         if(result!=STATE_OK)
565                 die (result, "could not fetch information from server\n");
566                 
567         if (!strncmp(recv_buffer,"ERROR",5))
568                 die (STATE_UNKNOWN, "NSClient - %s\n",recv_buffer);
571 int strtoularray(unsigned long *array, char *string, const char *delim) {
572         /* split a <delim> delimited string into a long array */
573         int idx=0;
574         char *t1;
576         for (idx=0;idx<MAX_VALUE_LIST;idx++)
577                 array[idx]=0;
578         
579         idx=0;
580         for(t1 = strtok(string,delim);t1 != NULL; t1 = strtok(NULL, delim)) {
581                 if (is_numeric(t1) && idx<MAX_VALUE_LIST) {
582                         array[idx]=strtoul(t1,NULL,10);
583                         idx++;
584                 } else  
585                         return FALSE;
586         }               
587         return TRUE;
590 void preparelist(char *string) {
591         /* Replace all , with & which is the delimiter for the request */
592         int i;
594         for (i = 0; (size_t)i < strlen(string); i++)
595                 if (string[i] == ',') {
596                         string[i]='&';
597                 }
602 void print_help(void)
604         print_revision(progname,"$Revision$");
605         printf (_("\
606 Copyright (c) 2000 Yves Rubin (rubiyz@yahoo.com)\n\n\
607 This plugin collects data from the NSClient service running on a\n\
608 Windows NT/2000/XP server.\n\n"));
609         print_usage();
610   printf (_("\nOptions:\n\
611 -H, --hostname=HOST\n\
612   Name of the host to check\n\
613 -p, --port=INTEGER\n\
614   Optional port number (default: %d)\n\
615 -s <password>\n\
616   Password needed for the request\n\
617 -w, --warning=INTEGER\n\
618   Threshold which will result in a warning status\n\
619 -c, --critical=INTEGER\n\
620   Threshold which will result in a critical status\n\
621 -t, --timeout=INTEGER\n\
622   Seconds before connection attempt times out (default: %d)\n\
623 -h, --help\n\
624   Print this help screen\n\
625 -V, --version\n\
626   Print version information\n"),
627                 PORT, DEFAULT_SOCKET_TIMEOUT);
628   printf (_("\
629 -v, --variable=STRING\n\
630   Variable to check.  Valid variables are:\n"));
631   printf (_("\
632    CLIENTVERSION = Get the NSClient version\n\
633      If -l <version> is specified, will return warning if versions differ.\n"));
634   printf (_("\
635    CPULOAD = Average CPU load on last x minutes.\n\
636      Request a -l parameter with the following syntax:\n\
637      -l <minutes range>,<warning threshold>,<critical threshold>.\n\
638      <minute range> should be less than 24*60.\n\
639      Thresholds are percentage and up to 10 requests can be done in one shot.\n\
640      ie: -l 60,90,95,120,90,95\n"));
641   printf (_("\
642    UPTIME = Get the uptime of the machine.\n\
643      No specific parameters. No warning or critical threshold\n"));
644   printf (_("\
645    USEDDISKSPACE = Size and percentage of disk use.\n\
646      Request a -l parameter containing the drive letter only.\n\
647      Warning and critical thresholds can be specified with -w and -c.\n"));
648   printf (_("\
649    MEMUSE = Memory use.\n\
650      Warning and critical thresholds can be specified with -w and -c.\n"));
651   printf (_("\
652    SERVICESTATE = Check the state of one or several services.\n\
653      Request a -l parameters with the following syntax:\n\
654      -l <service1>,<service2>,<service3>,...\n\
655      You can specify -d SHOWALL in case you want to see working services\n\
656                  in the returned string.\n"));
657   printf (_("\
658    PROCSTATE = Check if one or several process are running.\n\
659      Same syntax as SERVICESTATE.\n"));
660   printf (_("\
661    COUNTER = Check any performance counter of Windows NT/2000.\n\
662      Request a -l parameters with the following syntax:\n\
663                  -l \"\\\\<performance object>\\\\counter\",\"<description>\n\
664      The <description> parameter is optional and \n\
665      is given to a printf output command which require a float parameters.\n\
666      Some examples:\n\
667        \"Paging file usage is %%.2f %%%%\"\n\
668        \"%%.f %%%% paging file used.\"\n"));
669   printf (_("Notes:\n\
670  - The NSClient service should be running on the server to get any information\n\
671    (http://nsclient.ready2run.nl).\n\
672  - Critical thresholds should be lower than warning thresholds\n"));
677 void print_usage(void)
679         printf(_("\
680 Usage: %s -H host -v variable [-p port] [-w warning] [-c critical]\n\
681   [-l params] [-d SHOWALL] [-t timeout]\n"), progname);
682         printf (_(UT_HLP_VRS), progname, progname);