summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Guyot-Sionnest <dermoth@aei.ca>2009-03-24 05:50:01 (GMT)
committerThomas Guyot-Sionnest <dermoth@aei.ca>2009-03-24 05:50:01 (GMT)
commitf2f2f35240c976ddc6e44cd6276df88aad812199 (patch)
treeff7f45b43d9ce7e2e7874558d0f1f1f0ec837b77
parent8aa84840bb9b880ca1b2060e25ec6a1f3ee90ba1 (diff)
downloadmonitoring-plugins-f2f2f35240c976ddc6e44cd6276df88aad812199.tar.gz
Whitespace and intend cleanup
-rw-r--r--plugins/check_nt.c420
1 files changed, 210 insertions, 210 deletions
diff --git a/plugins/check_nt.c b/plugins/check_nt.c
index ee5e2a6..48bdccc 100644
--- a/plugins/check_nt.c
+++ b/plugins/check_nt.c
@@ -160,9 +160,9 @@ int main(int argc, char **argv){
160 160
161 /* loop until one of the parameters is wrong or not present */ 161 /* loop until one of the parameters is wrong or not present */
162 while (lvalue_list[0+offset]> (unsigned long)0 && 162 while (lvalue_list[0+offset]> (unsigned long)0 &&
163 lvalue_list[0+offset]<=(unsigned long)17280 && 163 lvalue_list[0+offset]<=(unsigned long)17280 &&
164 lvalue_list[1+offset]> (unsigned long)0 && 164 lvalue_list[1+offset]> (unsigned long)0 &&
165 lvalue_list[1+offset]<=(unsigned long)100 && 165 lvalue_list[1+offset]<=(unsigned long)100 &&
166 lvalue_list[2+offset]> (unsigned long)0 && 166 lvalue_list[2+offset]> (unsigned long)0 &&
167 lvalue_list[2+offset]<=(unsigned long)100) { 167 lvalue_list[2+offset]<=(unsigned long)100) {
168 168
@@ -171,7 +171,7 @@ int main(int argc, char **argv){
171 fetch_data (server_address, server_port, send_buffer); 171 fetch_data (server_address, server_port, send_buffer);
172 172
173 utilization=strtoul(recv_buffer,NULL,10); 173 utilization=strtoul(recv_buffer,NULL,10);
174 174
175 /* Check if any of the request is in a warning or critical state */ 175 /* Check if any of the request is in a warning or critical state */
176 if(utilization >= lvalue_list[2+offset]) 176 if(utilization >= lvalue_list[2+offset])
177 return_code=STATE_CRITICAL; 177 return_code=STATE_CRITICAL;
@@ -191,7 +191,7 @@ int main(int argc, char **argv){
191 perfdata = temp_string_perf; 191 perfdata = temp_string_perf;
192 } else 192 } else
193 output_message = strdup (_("not enough values for -l parameters")); 193 output_message = strdup (_("not enough values for -l parameters"));
194 } 194 }
195 break; 195 break;
196 196
197 case CHECK_UPTIME: 197 case CHECK_UPTIME:
@@ -199,7 +199,7 @@ int main(int argc, char **argv){
199 asprintf(&send_buffer, "%s&3", req_password); 199 asprintf(&send_buffer, "%s&3", req_password);
200 fetch_data (server_address, server_port, send_buffer); 200 fetch_data (server_address, server_port, send_buffer);
201 uptime=strtoul(recv_buffer,NULL,10); 201 uptime=strtoul(recv_buffer,NULL,10);
202 updays = uptime / 86400; 202 updays = uptime / 86400;
203 uphours = (uptime % 86400) / 3600; 203 uphours = (uptime % 86400) / 3600;
204 upminutes = ((uptime % 86400) % 3600) / 60; 204 upminutes = ((uptime % 86400) % 3600) / 60;
205 asprintf(&output_message,_("System Uptime - %u day(s) %u hour(s) %u minute(s)"),updays,uphours, upminutes); 205 asprintf(&output_message,_("System Uptime - %u day(s) %u hour(s) %u minute(s)"),updays,uphours, upminutes);
@@ -237,9 +237,9 @@ int main(int argc, char **argv){
237 if(check_critical_value==TRUE && percent_used_space >= critical_value) 237 if(check_critical_value==TRUE && percent_used_space >= critical_value)
238 return_code=STATE_CRITICAL; 238 return_code=STATE_CRITICAL;
239 else if (check_warning_value==TRUE && percent_used_space >= warning_value) 239 else if (check_warning_value==TRUE && percent_used_space >= warning_value)
240 return_code=STATE_WARNING; 240 return_code=STATE_WARNING;
241 else 241 else
242 return_code=STATE_OK; 242 return_code=STATE_OK;
243 243
244 output_message = strdup (temp_string); 244 output_message = strdup (temp_string);
245 perfdata = temp_string_perf; 245 perfdata = temp_string_perf;
@@ -267,7 +267,7 @@ int main(int argc, char **argv){
267 break; 267 break;
268 268
269 case CHECK_MEMUSE: 269 case CHECK_MEMUSE:
270 270
271 asprintf(&send_buffer,"%s&7", req_password); 271 asprintf(&send_buffer,"%s&7", req_password);
272 fetch_data (server_address, server_port, send_buffer); 272 fetch_data (server_address, server_port, send_buffer);
273 mem_commitLimit=atof(strtok(recv_buffer,"&")); 273 mem_commitLimit=atof(strtok(recv_buffer,"&"));
@@ -276,130 +276,129 @@ int main(int argc, char **argv){
276 warning_used_space = ((float)warning_value / 100) * mem_commitLimit; 276 warning_used_space = ((float)warning_value / 100) * mem_commitLimit;
277 critical_used_space = ((float)critical_value / 100) * mem_commitLimit; 277 critical_used_space = ((float)critical_value / 100) * mem_commitLimit;
278 278
279 /* Divisor should be 1048567, not 3044515, as we are measuring "Commit Charge" here, 279 /* Divisor should be 1048567, not 3044515, as we are measuring "Commit Charge" here,
280 which equals RAM + Pagefiles. */ 280 which equals RAM + Pagefiles. */
281 asprintf(&output_message,_("Memory usage: total:%.2f Mb - used: %.2f Mb (%.0f%%) - free: %.2f Mb (%.0f%%)"), 281 asprintf(&output_message,_("Memory usage: total:%.2f Mb - used: %.2f Mb (%.0f%%) - free: %.2f Mb (%.0f%%)"),
282 mem_commitLimit / 1048567, mem_commitByte / 1048567, percent_used_space, 282 mem_commitLimit / 1048567, mem_commitByte / 1048567, percent_used_space,
283 (mem_commitLimit - mem_commitByte) / 1048567, (mem_commitLimit - mem_commitByte) / mem_commitLimit * 100); 283 (mem_commitLimit - mem_commitByte) / 1048567, (mem_commitLimit - mem_commitByte) / mem_commitLimit * 100);
284 asprintf(&perfdata,_("'Memory usage'=%.2fMb;%.2f;%.2f;0.00;%.2f"), mem_commitByte / 1048567, 284 asprintf(&perfdata,_("'Memory usage'=%.2fMb;%.2f;%.2f;0.00;%.2f"), mem_commitByte / 1048567,
285 warning_used_space / 1048567, critical_used_space / 1048567, mem_commitLimit / 1048567); 285 warning_used_space / 1048567, critical_used_space / 1048567, mem_commitLimit / 1048567);
286 286
287 return_code=STATE_OK; 287 return_code=STATE_OK;
288 if(check_critical_value==TRUE && percent_used_space >= critical_value) 288 if(check_critical_value==TRUE && percent_used_space >= critical_value)
289 return_code=STATE_CRITICAL; 289 return_code=STATE_CRITICAL;
290 else if (check_warning_value==TRUE && percent_used_space >= warning_value) 290 else if (check_warning_value==TRUE && percent_used_space >= warning_value)
291 return_code=STATE_WARNING; 291 return_code=STATE_WARNING;
292 292
293 break; 293 break;
294 294
295 case CHECK_COUNTER: 295 case CHECK_COUNTER:
296 296
297 297
298 /* 298 /*
299 CHECK_COUNTER has been modified to provide extensive perfdata information. 299 CHECK_COUNTER has been modified to provide extensive perfdata information.
300 In order to do this, some modifications have been done to the code 300 In order to do this, some modifications have been done to the code
301 and some constraints have been introduced. 301 and some constraints have been introduced.
302 302
303 1) For the sake of simplicity of the code, perfdata information will only be 303 1) For the sake of simplicity of the code, perfdata information will only be
304 provided when the "description" field is added. 304 provided when the "description" field is added.
305 305
306 2) If the counter you're going to measure is percent-based, the code will detect 306 2) If the counter you're going to measure is percent-based, the code will detect
307 the percent sign in its name and will attribute minimum (0%) and maximum (100%) 307 the percent sign in its name and will attribute minimum (0%) and maximum (100%)
308 values automagically, as well the ¨%" sign to graph units. 308 values automagically, as well the ¨%" sign to graph units.
309 309
310 3) OTOH, if the counter is "absolute", you'll have to provide the following 310 3) OTOH, if the counter is "absolute", you'll have to provide the following
311 the counter unit - that is, the dimensions of the counter you're getting. Examples: 311 the counter unit - that is, the dimensions of the counter you're getting. Examples:
312 pages/s, packets transferred, etc. 312 pages/s, packets transferred, etc.
313 313
314 4) If you want, you may provide the minimum and maximum values to expect. They aren't mandatory, 314 4) If you want, you may provide the minimum and maximum values to expect. They aren't mandatory,
315 but once specified they MUST have the same order of magnitude and units of -w and -c; otherwise. 315 but once specified they MUST have the same order of magnitude and units of -w and -c; otherwise.
316 strange things will happen when you make graphs of your data. 316 strange things will happen when you make graphs of your data.
317 */ 317 */
318 318
319 if (value_list == NULL) 319 if (value_list == NULL)
320 output_message = strdup (_("No counter specified")); 320 output_message = strdup (_("No counter specified"));
321 else 321 else
322 { 322 {
323 preparelist (value_list); /* replace , between services with & to send the request */ 323 preparelist (value_list); /* replace , between services with & to send the request */
324 isPercent = (strchr (value_list, '%') != NULL); 324 isPercent = (strchr (value_list, '%') != NULL);
325
326 strtok (value_list, "&"); /* burn the first parameters */
327 description = strtok (NULL, "&");
328 counter_unit = strtok (NULL, "&");
329 asprintf (&send_buffer, "%s&8&%s", req_password, value_list);
330 fetch_data (server_address, server_port, send_buffer);
331 counter_value = atof (recv_buffer);
332
333 325
334 if (description == NULL) 326 strtok (value_list, "&"); /* burn the first parameters */
335 asprintf (&output_message, "%.f", counter_value); 327 description = strtok (NULL, "&");
336 else if (isPercent) 328 counter_unit = strtok (NULL, "&");
337 { 329 asprintf (&send_buffer, "%s&8&%s", req_password, value_list);
338 counter_unit = strdup ("%"); 330 fetch_data (server_address, server_port, send_buffer);
339 allRight = TRUE; 331 counter_value = atof (recv_buffer);
340 } 332
333 if (description == NULL)
334 asprintf (&output_message, "%.f", counter_value);
335 else if (isPercent)
336 {
337 counter_unit = strdup ("%");
338 allRight = TRUE;
339 }
341 340
342 if ((counter_unit != NULL) && (!allRight)) 341 if ((counter_unit != NULL) && (!allRight))
343 { 342 {
344 minval = strtok (NULL, "&"); 343 minval = strtok (NULL, "&");
345 maxval = strtok (NULL, "&"); 344 maxval = strtok (NULL, "&");
346 345
347 /* All parameters specified. Let's check the numbers */ 346 /* All parameters specified. Let's check the numbers */
348 347
349 fminval = (minval != NULL) ? strtod (minval, &errcvt) : -1; 348 fminval = (minval != NULL) ? strtod (minval, &errcvt) : -1;
350 fmaxval = (minval != NULL) ? strtod (maxval, &errcvt) : -1; 349 fmaxval = (minval != NULL) ? strtod (maxval, &errcvt) : -1;
351 350
352 if ((fminval == 0) && (minval == errcvt)) 351 if ((fminval == 0) && (minval == errcvt))
353 output_message = strdup (_("Minimum value contains non-numbers")); 352 output_message = strdup (_("Minimum value contains non-numbers"));
354 else 353 else
355 { 354 {
356 if ((fmaxval == 0) && (maxval == errcvt)) 355 if ((fmaxval == 0) && (maxval == errcvt))
357 output_message = strdup (_("Maximum value contains non-numbers")); 356 output_message = strdup (_("Maximum value contains non-numbers"));
358 else 357 else
359 allRight = TRUE; /* Everything is OK. */ 358 allRight = TRUE; /* Everything is OK. */
360 359
361 } 360 }
362 } 361 }
363 else if ((counter_unit == NULL) && (description != NULL)) 362 else if ((counter_unit == NULL) && (description != NULL))
364 output_message = strdup (_("No unit counter specified")); 363 output_message = strdup (_("No unit counter specified"));
365 364
366 if (allRight) 365 if (allRight)
367 { 366 {
368 /* Let's format the output string, finally... */ 367 /* Let's format the output string, finally... */
369 if (strstr(description, "%") == NULL) { 368 if (strstr(description, "%") == NULL) {
370 asprintf (&output_message, "%s = %.2f %s", description, counter_value, counter_unit); 369 asprintf (&output_message, "%s = %.2f %s", description, counter_value, counter_unit);
371 } else { 370 } else {
372 /* has formatting, will segv if wrong */ 371 /* has formatting, will segv if wrong */
373 asprintf (&output_message, description, counter_value); 372 asprintf (&output_message, description, counter_value);
374 } 373 }
375 asprintf (&output_message, "%s |", output_message); 374 asprintf (&output_message, "%s |", output_message);
376 asprintf (&output_message,"%s %s", output_message, 375 asprintf (&output_message,"%s %s", output_message,
377 fperfdata (description, counter_value, 376 fperfdata (description, counter_value,
378 counter_unit, 1, warning_value, 1, critical_value, 377 counter_unit, 1, warning_value, 1, critical_value,
379 (!(isPercent) && (minval != NULL)), fminval, 378 (!(isPercent) && (minval != NULL)), fminval,
380 (!(isPercent) && (minval != NULL)), fmaxval)); 379 (!(isPercent) && (minval != NULL)), fmaxval));
381 } 380 }
382 } 381 }
383 382
384 if (critical_value > warning_value) 383 if (critical_value > warning_value)
385 { /* Normal thresholds */ 384 { /* Normal thresholds */
386 if (check_critical_value == TRUE && counter_value >= critical_value) 385 if (check_critical_value == TRUE && counter_value >= critical_value)
387 return_code = STATE_CRITICAL; 386 return_code = STATE_CRITICAL;
388 else if (check_warning_value == TRUE && counter_value >= warning_value) 387 else if (check_warning_value == TRUE && counter_value >= warning_value)
389 return_code = STATE_WARNING; 388 return_code = STATE_WARNING;
390 else 389 else
391 return_code = STATE_OK; 390 return_code = STATE_OK;
392 } 391 }
393 else 392 else
394 { /* inverse thresholds */ 393 { /* inverse thresholds */
395 return_code = STATE_OK; 394 return_code = STATE_OK;
396 if (check_critical_value == TRUE && counter_value <= critical_value) 395 if (check_critical_value == TRUE && counter_value <= critical_value)
397 return_code = STATE_CRITICAL; 396 return_code = STATE_CRITICAL;
398 else if (check_warning_value == TRUE && counter_value <= warning_value) 397 else if (check_warning_value == TRUE && counter_value <= warning_value)
399 return_code = STATE_WARNING; 398 return_code = STATE_WARNING;
400 } 399 }
401 break; 400 break;
402 401
403 case CHECK_FILEAGE: 402 case CHECK_FILEAGE:
404 403
405 if (value_list==NULL) 404 if (value_list==NULL)
@@ -411,27 +410,27 @@ int main(int argc, char **argv){
411 age_in_minutes = atoi(strtok(recv_buffer,"&")); 410 age_in_minutes = atoi(strtok(recv_buffer,"&"));
412 description = strtok(NULL,"&"); 411 description = strtok(NULL,"&");
413 output_message = strdup (description); 412 output_message = strdup (description);
414 413
415 if (critical_value > warning_value) { /* Normal thresholds */ 414 if (critical_value > warning_value) { /* Normal thresholds */
416 if(check_critical_value==TRUE && age_in_minutes >= critical_value) 415 if(check_critical_value==TRUE && age_in_minutes >= critical_value)
417 return_code=STATE_CRITICAL; 416 return_code=STATE_CRITICAL;
418 else if (check_warning_value==TRUE && age_in_minutes >= warning_value) 417 else if (check_warning_value==TRUE && age_in_minutes >= warning_value)
419 return_code=STATE_WARNING; 418 return_code=STATE_WARNING;
420 else 419 else
421 return_code=STATE_OK; 420 return_code=STATE_OK;
422 } 421 }
423 else { /* inverse thresholds */ 422 else { /* inverse thresholds */
424 if(check_critical_value==TRUE && age_in_minutes <= critical_value) 423 if(check_critical_value==TRUE && age_in_minutes <= critical_value)
425 return_code=STATE_CRITICAL; 424 return_code=STATE_CRITICAL;
426 else if (check_warning_value==TRUE && age_in_minutes <= warning_value) 425 else if (check_warning_value==TRUE && age_in_minutes <= warning_value)
427 return_code=STATE_WARNING; 426 return_code=STATE_WARNING;
428 else 427 else
429 return_code=STATE_OK; 428 return_code=STATE_OK;
430 } 429 }
431 } 430 }
432 break; 431 break;
433 432
434 case CHECK_INSTANCES: 433 case CHECK_INSTANCES:
435 if (value_list==NULL) 434 if (value_list==NULL)
436 output_message = strdup (_("No counter specified")); 435 output_message = strdup (_("No counter specified"));
437 else { 436 else {
@@ -441,7 +440,7 @@ int main(int argc, char **argv){
441 printf("NSClient - %s\n",recv_buffer); 440 printf("NSClient - %s\n",recv_buffer);
442 exit(STATE_UNKNOWN); 441 exit(STATE_UNKNOWN);
443 } 442 }
444 asprintf(&output_message,"%s",recv_buffer); 443 asprintf(&output_message,"%s",recv_buffer);
445 return_code=STATE_OK; 444 return_code=STATE_OK;
446 } 445 }
447 break; 446 break;
@@ -471,7 +470,7 @@ int process_arguments(int argc, char **argv){
471 470
472 int option = 0; 471 int option = 0;
473 static struct option longopts[] = 472 static struct option longopts[] =
474 { 473 {
475 {"port", required_argument,0,'p'}, 474 {"port", required_argument,0,'p'},
476 {"timeout", required_argument,0,'t'}, 475 {"timeout", required_argument,0,'t'},
477 {"critical", required_argument,0,'c'}, 476 {"critical", required_argument,0,'c'},
@@ -497,13 +496,13 @@ int process_arguments(int argc, char **argv){
497 argc--; 496 argc--;
498 } 497 }
499 498
500 for (c=1;c<argc;c++) { 499 for (c=1;c<argc;c++) {
501 if(strcmp("-to",argv[c])==0) 500 if(strcmp("-to",argv[c])==0)
502 strcpy(argv[c],"-t"); 501 strcpy(argv[c],"-t");
503 else if (strcmp("-wv",argv[c])==0) 502 else if (strcmp("-wv",argv[c])==0)
504 strcpy(argv[c],"-w"); 503 strcpy(argv[c],"-w");
505 else if (strcmp("-cv",argv[c])==0) 504 else if (strcmp("-cv",argv[c])==0)
506 strcpy(argv[c],"-c"); 505 strcpy(argv[c],"-c");
507 } 506 }
508 507
509 while (1) { 508 while (1) {
@@ -601,7 +600,7 @@ void fetch_data (const char *address, int port, const char *sendb) {
601 600
602 if(result!=STATE_OK) 601 if(result!=STATE_OK)
603 die (result, _("could not fetch information from server\n")); 602 die (result, _("could not fetch information from server\n"));
604 603
605 if (!strncmp(recv_buffer,"ERROR",5)) 604 if (!strncmp(recv_buffer,"ERROR",5))
606 die (STATE_UNKNOWN, "NSClient - %s\n",recv_buffer); 605 die (STATE_UNKNOWN, "NSClient - %s\n",recv_buffer);
607} 606}
@@ -613,15 +612,15 @@ int strtoularray(unsigned long *array, char *string, const char *delim) {
613 612
614 for (idx=0;idx<MAX_VALUE_LIST;idx++) 613 for (idx=0;idx<MAX_VALUE_LIST;idx++)
615 array[idx]=0; 614 array[idx]=0;
616 615
617 idx=0; 616 idx=0;
618 for(t1 = strtok(string,delim);t1 != NULL; t1 = strtok(NULL, delim)) { 617 for(t1 = strtok(string,delim);t1 != NULL; t1 = strtok(NULL, delim)) {
619 if (is_numeric(t1) && idx<MAX_VALUE_LIST) { 618 if (is_numeric(t1) && idx<MAX_VALUE_LIST) {
620 array[idx]=strtoul(t1,NULL,10); 619 array[idx]=strtoul(t1,NULL,10);
621 idx++; 620 idx++;
622 } else 621 } else
623 return FALSE; 622 return FALSE;
624 } 623 }
625 return TRUE; 624 return TRUE;
626} 625}
627 626
@@ -640,120 +639,121 @@ void preparelist(char *string) {
640void print_help(void) 639void print_help(void)
641{ 640{
642 print_revision(progname, NP_VERSION); 641 print_revision(progname, NP_VERSION);
643 642
644 printf ("Copyright (c) 2000 Yves Rubin (rubiyz@yahoo.com)\n"); 643 printf ("Copyright (c) 2000 Yves Rubin (rubiyz@yahoo.com)\n");
645 printf (COPYRIGHT, copyright, email); 644 printf (COPYRIGHT, copyright, email);
646 645
647 printf ("%s\n", _("This plugin collects data from the NSClient service running on a")); 646 printf ("%s\n", _("This plugin collects data from the NSClient service running on a"));
648 printf ("%s\n", _("Windows NT/2000/XP/2003 server.")); 647 printf ("%s\n", _("Windows NT/2000/XP/2003 server."));
649 648
650 printf ("\n\n"); 649 printf ("\n\n");
651 650
652 print_usage(); 651 print_usage();
653 652
654 printf (_(UT_HELP_VRSN)); 653 printf (_(UT_HELP_VRSN));
655 printf (_(UT_EXTRA_OPTS)); 654 printf (_(UT_EXTRA_OPTS));
656 655
657 printf ("%s\n", _("Options:")); 656 printf ("%s\n", _("Options:"));
658 printf (" %s\n", "-H, --hostname=HOST"); 657 printf (" %s\n", "-H, --hostname=HOST");
659 printf (" %s\n", _("Name of the host to check")); 658 printf (" %s\n", _("Name of the host to check"));
660 printf (" %s\n", "-p, --port=INTEGER"); 659 printf (" %s\n", "-p, --port=INTEGER");
661 printf (" %s", _("Optional port number (default: ")); 660 printf (" %s", _("Optional port number (default: "));
662 printf ("%d)\n", PORT); 661 printf ("%d)\n", PORT);
663 printf (" %s\n", "-s, --secret=<password>"); 662 printf (" %s\n", "-s, --secret=<password>");
664 printf (" %s\n", _("Password needed for the request")); 663 printf (" %s\n", _("Password needed for the request"));
665 printf (" %s\n", "-w, --warning=INTEGER"); 664 printf (" %s\n", "-w, --warning=INTEGER");
666 printf (" %s\n", _("Threshold which will result in a warning status")); 665 printf (" %s\n", _("Threshold which will result in a warning status"));
667 printf (" %s\n", "-c, --critical=INTEGER"); 666 printf (" %s\n", "-c, --critical=INTEGER");
668 printf (" %s\n", _("Threshold which will result in a critical status")); 667 printf (" %s\n", _("Threshold which will result in a critical status"));
669 printf (" %s\n", "-t, --timeout=INTEGER"); 668 printf (" %s\n", "-t, --timeout=INTEGER");
670 printf (" %s", _("Seconds before connection attempt times out (default: ")); 669 printf (" %s", _("Seconds before connection attempt times out (default: "));
671 printf (" %s\n", "-l, --params=<parameters>"); 670 printf (" %s\n", "-l, --params=<parameters>");
672 printf (" %s", _("Parameters passed to specified check (see below)")); 671 printf (" %s", _("Parameters passed to specified check (see below)"));
673 printf (" %s\n", "-d, --display={SHOWALL}"); 672 printf (" %s\n", "-d, --display={SHOWALL}");
674 printf (" %s", _("Display options (currently only SHOWALL works)")); 673 printf (" %s", _("Display options (currently only SHOWALL works)"));
675 printf ("%d)\n", DEFAULT_SOCKET_TIMEOUT); 674 printf ("%d)\n", DEFAULT_SOCKET_TIMEOUT);
676 printf (" %s\n", "-h, --help"); 675 printf (" %s\n", "-h, --help");
677 printf (" %s\n", _("Print this help screen")); 676 printf (" %s\n", _("Print this help screen"));
678 printf (" %s\n", "-V, --version"); 677 printf (" %s\n", "-V, --version");
679 printf (" %s\n", _("Print version information")); 678 printf (" %s\n", _("Print version information"));
680 printf (" %s\n", "-v, --variable=STRING"); 679 printf (" %s\n", "-v, --variable=STRING");
681 printf (" %s\n\n", _("Variable to check")); 680 printf (" %s\n\n", _("Variable to check"));
682 printf ("%s\n", _("Valid variables are:")); 681 printf ("%s\n", _("Valid variables are:"));
683 printf (" %s", "CLIENTVERSION ="); 682 printf (" %s", "CLIENTVERSION =");
684 printf (" %s\n", _("Get the NSClient version")); 683 printf (" %s\n", _("Get the NSClient version"));
685 printf (" %s\n", _("If -l <version> is specified, will return warning if versions differ.")); 684 printf (" %s\n", _("If -l <version> is specified, will return warning if versions differ."));
686 printf (" %s\n", "CPULOAD ="); 685 printf (" %s\n", "CPULOAD =");
687 printf (" %s\n", _("Average CPU load on last x minutes.")); 686 printf (" %s\n", _("Average CPU load on last x minutes."));
688 printf (" %s\n", _("Request a -l parameter with the following syntax:")); 687 printf (" %s\n", _("Request a -l parameter with the following syntax:"));
689 printf (" %s\n", _("-l <minutes range>,<warning threshold>,<critical threshold>.")); 688 printf (" %s\n", _("-l <minutes range>,<warning threshold>,<critical threshold>."));
690 printf (" %s\n", _("<minute range> should be less than 24*60.")); 689 printf (" %s\n", _("<minute range> should be less than 24*60."));
691 printf (" %s\n", _("Thresholds are percentage and up to 10 requests can be done in one shot.")); 690 printf (" %s\n", _("Thresholds are percentage and up to 10 requests can be done in one shot."));
692 printf (" %s\n", "ie: -l 60,90,95,120,90,95"); 691 printf (" %s\n", "ie: -l 60,90,95,120,90,95");
693 printf (" %s\n", "UPTIME ="); 692 printf (" %s\n", "UPTIME =");
694 printf (" %s\n", _("Get the uptime of the machine.")); 693 printf (" %s\n", _("Get the uptime of the machine."));
695 printf (" %s\n", _("No specific parameters. No warning or critical threshold")); 694 printf (" %s\n", _("No specific parameters. No warning or critical threshold"));
696 printf (" %s\n", "USEDDISKSPACE ="); 695 printf (" %s\n", "USEDDISKSPACE =");
697 printf (" %s\n", _("Size and percentage of disk use.")); 696 printf (" %s\n", _("Size and percentage of disk use."));
698 printf (" %s\n", _("Request a -l parameter containing the drive letter only.")); 697 printf (" %s\n", _("Request a -l parameter containing the drive letter only."));
699 printf (" %s\n", _("Warning and critical thresholds can be specified with -w and -c.")); 698 printf (" %s\n", _("Warning and critical thresholds can be specified with -w and -c."));
700 printf (" %s\n", "MEMUSE ="); 699 printf (" %s\n", "MEMUSE =");
701 printf (" %s\n", _("Memory use.")); 700 printf (" %s\n", _("Memory use."));
702 printf (" %s\n", _("Warning and critical thresholds can be specified with -w and -c.")); 701 printf (" %s\n", _("Warning and critical thresholds can be specified with -w and -c."));
703 printf (" %s\n", "SERVICESTATE ="); 702 printf (" %s\n", "SERVICESTATE =");
704 printf (" %s\n", _("Check the state of one or several services.")); 703 printf (" %s\n", _("Check the state of one or several services."));
705 printf (" %s\n", _("Request a -l parameters with the following syntax:")); 704 printf (" %s\n", _("Request a -l parameters with the following syntax:"));
706 printf (" %s\n", _("-l <service1>,<service2>,<service3>,...")); 705 printf (" %s\n", _("-l <service1>,<service2>,<service3>,..."));
707 printf (" %s\n", _("You can specify -d SHOWALL in case you want to see working services")); 706 printf (" %s\n", _("You can specify -d SHOWALL in case you want to see working services"));
708 printf (" %s\n", _("in the returned string.")); 707 printf (" %s\n", _("in the returned string."));
709 printf (" %s\n", "PROCSTATE ="); 708 printf (" %s\n", "PROCSTATE =");
710 printf (" %s\n", _("Check if one or several process are running.")); 709 printf (" %s\n", _("Check if one or several process are running."));
711 printf (" %s\n", _("Same syntax as SERVICESTATE.")); 710 printf (" %s\n", _("Same syntax as SERVICESTATE."));
712 printf (" %s\n", "COUNTER ="); 711 printf (" %s\n", "COUNTER =");
713 printf (" %s\n", _("Check any performance counter of Windows NT/2000.")); 712 printf (" %s\n", _("Check any performance counter of Windows NT/2000."));
714 printf (" %s\n", _("Request a -l parameters with the following syntax:")); 713 printf (" %s\n", _("Request a -l parameters with the following syntax:"));
715 printf (" %s\n", _("-l \"\\\\<performance object>\\\\counter\",\"<description>")); 714 printf (" %s\n", _("-l \"\\\\<performance object>\\\\counter\",\"<description>"));
716 printf (" %s\n", _("The <description> parameter is optional and is given to a printf ")); 715 printf (" %s\n", _("The <description> parameter is optional and is given to a printf "));
717 printf (" %s\n", _("output command which requires a float parameter.")); 716 printf (" %s\n", _("output command which requires a float parameter."));
718 printf (" %s\n", _("If <description> does not include \"%%\", it is used as a label.")); 717 printf (" %s\n", _("If <description> does not include \"%%\", it is used as a label."));
719 printf (" %s\n", _("Some examples:")); 718 printf (" %s\n", _("Some examples:"));
720 printf (" %s\n", "\"Paging file usage is %%.2f %%%%\""); 719 printf (" %s\n", "\"Paging file usage is %%.2f %%%%\"");
721 printf (" %s\n", "\"%%.f %%%% paging file used.\""); 720 printf (" %s\n", "\"%%.f %%%% paging file used.\"");
722 printf (" %s\n", "INSTANCES ="); 721 printf (" %s\n", "INSTANCES =");
723 printf (" %s\n", _("Check any performance counter object of Windows NT/2000.")); 722 printf (" %s\n", _("Check any performance counter object of Windows NT/2000."));
724 printf (" %s\n", _("Syntax: check_nt -H <hostname> -p <port> -v INSTANCES -l <counter object>")); 723 printf (" %s\n", _("Syntax: check_nt -H <hostname> -p <port> -v INSTANCES -l <counter object>"));
725 printf (" %s\n", _("<counter object> is a Windows Perfmon Counter object (eg. Process),")); 724 printf (" %s\n", _("<counter object> is a Windows Perfmon Counter object (eg. Process),"));
726 printf (" %s\n", _("if it is two words, it should be enclosed in quotes")); 725 printf (" %s\n", _("if it is two words, it should be enclosed in quotes"));
727 printf (" %s\n", _("The returned results will be a comma-separated list of instances on ")); 726 printf (" %s\n", _("The returned results will be a comma-separated list of instances on "));
728 printf (" %s\n", _(" the selected computer for that object.")); 727 printf (" %s\n", _(" the selected computer for that object."));
729 printf (" %s\n", _("The purpose of this is to be run from command line to determine what instances")); 728 printf (" %s\n", _("The purpose of this is to be run from command line to determine what instances"));
730 printf (" %s\n", _(" are available for monitoring without having to log onto the Windows server")); 729 printf (" %s\n", _(" are available for monitoring without having to log onto the Windows server"));
731 printf (" %s\n", _(" to run Perfmon directly.")); 730 printf (" %s\n", _(" to run Perfmon directly."));
732 printf (" %s\n", _("It can also be used in scripts that automatically create Nagios service")); 731 printf (" %s\n", _("It can also be used in scripts that automatically create Nagios service"));
733 printf (" %s\n", _(" configuration files.")); 732 printf (" %s\n", _(" configuration files."));
734 printf (" %s\n", _("Some examples:")); 733 printf (" %s\n", _("Some examples:"));
735 printf (" %s\n\n", _("check_nt -H 192.168.1.1 -p 1248 -v INSTANCES -l Process")); 734 printf (" %s\n\n", _("check_nt -H 192.168.1.1 -p 1248 -v INSTANCES -l Process"));
736 735
737 printf ("%s\n", _("Notes:")); 736 printf ("%s\n", _("Notes:"));
738 printf (" %s\n", _("- The NSClient service should be running on the server to get any information")); 737 printf (" %s\n", _("- The NSClient service should be running on the server to get any information"));
739 printf (" %s\n", "(http://nsclient.ready2run.nl)."); 738 printf (" %s\n", "(http://nsclient.ready2run.nl).");
740 printf (" %s\n", _("- Critical thresholds should be lower than warning thresholds")); 739 printf (" %s\n", _("- Critical thresholds should be lower than warning thresholds"));
741 printf (" %s\n", _("- Default port 1248 is sometimes in use by other services. The error")); 740 printf (" %s\n", _("- Default port 1248 is sometimes in use by other services. The error"));
742 printf (" %s\n", _("output when this happens contains \"Cannot map xxxxx to protocol number\".")); 741 printf (" %s\n", _("output when this happens contains \"Cannot map xxxxx to protocol number\"."));
743 printf (" %s\n", _("One fix for this is to change the port to something else on check_nt ")); 742 printf (" %s\n", _("One fix for this is to change the port to something else on check_nt "));
744 printf (" %s\n", _("and on the client service it\'s connecting to.")); 743 printf (" %s\n", _("and on the client service it\'s connecting to."));
745#ifdef NP_EXTRA_OPTS 744#ifdef NP_EXTRA_OPTS
746 printf (" -%s", _(UT_EXTRA_OPTS_NOTES)); 745 printf (" -%s", _(UT_EXTRA_OPTS_NOTES));
747#endif 746#endif
748 747
749 printf (_(UT_SUPPORT)); 748 printf (_(UT_SUPPORT));
750} 749}
751 750
752 751
753 752
754void print_usage(void) 753void print_usage(void)
755{ 754{
756 printf (_("Usage:")); 755 printf (_("Usage:"));
757 printf ("%s -H host -v variable [-p port] [-w warning] [-c critical]\n",progname); 756 printf ("%s -H host -v variable [-p port] [-w warning] [-c critical]\n",progname);
758 printf ("[-l params] [-d SHOWALL] [-t timeout]\n"); 757 printf ("[-l params] [-d SHOWALL] [-t timeout]\n");
759} 758}
759