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