Code

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