summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--NEWS3
-rw-r--r--THANKS.in1
-rw-r--r--plugins/check_nt.c47
3 files changed, 43 insertions, 8 deletions
diff --git a/NEWS b/NEWS
index b48676dc..37d2ac1e 100644
--- a/NEWS
+++ b/NEWS
@@ -1,5 +1,8 @@
1This file documents the major additions and syntax changes between releases. 1This file documents the major additions and syntax changes between releases.
2 2
31.4.12 or 1.5 ??
4 Added ./check_nt -v INSTANCES to count number of instances (Alessandro Ren)
5
31.4.11 13th December 2007 61.4.11 13th December 2007
4 Fixed check_http regression in 1.4.10 where following redirects to 7 Fixed check_http regression in 1.4.10 where following redirects to
5 relative URLs on virtual hosts failed if both "-H" and "-I" were used 8 relative URLs on virtual hosts failed if both "-H" and "-I" were used
diff --git a/THANKS.in b/THANKS.in
index 54fbfd57..8d64f656 100644
--- a/THANKS.in
+++ b/THANKS.in
@@ -229,3 +229,4 @@ Matteo HCE Valsasna
229Bernhard Fischer 229Bernhard Fischer
230fabiodds 230fabiodds
231Tom Payerle 231Tom Payerle
232Alessandro Ren
diff --git a/plugins/check_nt.c b/plugins/check_nt.c
index fe47a58b..b916cc01 100644
--- a/plugins/check_nt.c
+++ b/plugins/check_nt.c
@@ -55,7 +55,8 @@ enum checkvars {
55 CHECK_PROCSTATE, 55 CHECK_PROCSTATE,
56 CHECK_MEMUSE, 56 CHECK_MEMUSE,
57 CHECK_COUNTER, 57 CHECK_COUNTER,
58 CHECK_FILEAGE 58 CHECK_FILEAGE,
59 CHECK_INSTANCES
59}; 60};
60 61
61enum { 62enum {
@@ -414,7 +415,7 @@ int main(int argc, char **argv){
414 return_code=STATE_WARNING; 415 return_code=STATE_WARNING;
415 else 416 else
416 return_code=STATE_OK; 417 return_code=STATE_OK;
417 } 418 }
418 else { /* inverse thresholds */ 419 else { /* inverse thresholds */
419 if(check_critical_value==TRUE && age_in_minutes <= critical_value) 420 if(check_critical_value==TRUE && age_in_minutes <= critical_value)
420 return_code=STATE_CRITICAL; 421 return_code=STATE_CRITICAL;
@@ -426,6 +427,21 @@ int main(int argc, char **argv){
426 } 427 }
427 break; 428 break;
428 429
430 case CHECK_INSTANCES:
431 if (value_list==NULL)
432 output_message = strdup (_("No counter specified"));
433 else {
434 asprintf(&send_buffer,"%s&10&%s", req_password,value_list);
435 fetch_data (server_address, server_port, send_buffer);
436 if (!strncmp(recv_buffer,"ERROR",5)) {
437 printf("NSClient - %s\n",recv_buffer);
438 exit(STATE_UNKNOWN);
439 }
440 asprintf(&output_message,"%s",recv_buffer);
441 return_code=STATE_OK;
442 }
443 break;
444
429 case CHECK_NONE: 445 case CHECK_NONE:
430 default: 446 default:
431 usage4 (_("Please specify a variable to check")); 447 usage4 (_("Please specify a variable to check"));
@@ -483,14 +499,13 @@ int process_arguments(int argc, char **argv){
483 strcpy(argv[c],"-c"); 499 strcpy(argv[c],"-c");
484 } 500 }
485 501
486 while (1){ 502 while (1) {
487 c = getopt_long(argc,argv,"+hVH:t:c:w:p:v:l:s:d:",longopts,&option); 503 c = getopt_long(argc,argv,"+hVH:t:c:w:p:v:l:s:d:",longopts,&option);
488 504
489 if (c==-1||c==EOF||c==1) 505 if (c==-1||c==EOF||c==1)
490 break; 506 break;
491 507
492 switch (c) 508 switch (c) {
493 {
494 case '?': /* print short usage statement if args not parsable */ 509 case '?': /* print short usage statement if args not parsable */
495 usage5 (); 510 usage5 ();
496 case 'h': /* help */ 511 case 'h': /* help */
@@ -533,6 +548,8 @@ int process_arguments(int argc, char **argv){
533 vars_to_check=CHECK_COUNTER; 548 vars_to_check=CHECK_COUNTER;
534 else if(!strcmp(optarg,"FILEAGE")) 549 else if(!strcmp(optarg,"FILEAGE"))
535 vars_to_check=CHECK_FILEAGE; 550 vars_to_check=CHECK_FILEAGE;
551 else if(!strcmp(optarg,"INSTANCES"))
552 vars_to_check=CHECK_INSTANCES;
536 else 553 else
537 return ERROR; 554 return ERROR;
538 break; 555 break;
@@ -671,7 +688,7 @@ void print_help(void)
671 printf (" %s\n", "MEMUSE ="); 688 printf (" %s\n", "MEMUSE =");
672 printf (" %s\n", _("Memory use.")); 689 printf (" %s\n", _("Memory use."));
673 printf (" %s\n", _("Warning and critical thresholds can be specified with -w and -c.")); 690 printf (" %s\n", _("Warning and critical thresholds can be specified with -w and -c."));
674 printf (" %s\n,", "SERVICESTATE ="); 691 printf (" %s\n", "SERVICESTATE =");
675 printf (" %s\n", _("Check the state of one or several services.")); 692 printf (" %s\n", _("Check the state of one or several services."));
676 printf (" %s\n", _("Request a -l parameters with the following syntax:")); 693 printf (" %s\n", _("Request a -l parameters with the following syntax:"));
677 printf (" %s\n", _("-l <service1>,<service2>,<service3>,...")); 694 printf (" %s\n", _("-l <service1>,<service2>,<service3>,..."));
@@ -686,10 +703,24 @@ void print_help(void)
686 printf (" %s\n", _("-l \"\\\\<performance object>\\\\counter\",\"<description>")); 703 printf (" %s\n", _("-l \"\\\\<performance object>\\\\counter\",\"<description>"));
687 printf (" %s\n", _("The <description> parameter is optional and is given to a printf ")); 704 printf (" %s\n", _("The <description> parameter is optional and is given to a printf "));
688 printf (" %s\n", _("output command which requires a float parameter.")); 705 printf (" %s\n", _("output command which requires a float parameter."));
689 printf (" %s\n\n", _("If <description> does not include \"%%\", it is used as a label.")); 706 printf (" %s\n", _("If <description> does not include \"%%\", it is used as a label."));
690 printf (" %s\n", _("Some examples:")); 707 printf (" %s\n", _("Some examples:"));
691 printf (" %s\n", "\"Paging file usage is %%.2f %%%%\""); 708 printf (" %s\n", "\"Paging file usage is %%.2f %%%%\"");
692 printf (" %s\n\n", "\"%%.f %%%% paging file used.\""); 709 printf (" %s\n", "\"%%.f %%%% paging file used.\"");
710 printf (" %s\n", "INSTANCES =");
711 printf (" %s\n", _("Check any performance counter object of Windows NT/2000."));
712 printf (" %s\n", _("Syntax: check_nt -H <hostname> -p <port> -v INSTANCES -l <counter object>"));
713 printf (" %s\n", _("<counter object> is a Windows Perfmon Counter object (eg. Process),"));
714 printf (" %s\n", _("if it is two words, it should be enclosed in quotes"));
715 printf (" %s\n", _("The returned results will be a comma-separated list of instances on "));
716 printf (" %s\n", _(" the selected computer for that object."));
717 printf (" %s\n", _("The purpose of this is to be run from command line to determine what instances"));
718 printf (" %s\n", _(" are available for monitoring without having to log onto the Windows server"));
719 printf (" %s\n", _(" to run Perfmon directly."));
720 printf (" %s\n", _("It can also be used in scripts that automatically create Nagios service"));
721 printf (" %s\n", _(" configuration files."));
722 printf (" %s\n", _("Some examples:"));
723 printf (" %s\n\n", _("check_nt -H 192.168.1.1 -p 1248 -v INSTANCES -l Process"));
693 printf (_("Notes:")); 724 printf (_("Notes:"));
694 printf (" %s\n", _("- The NSClient service should be running on the server to get any information")); 725 printf (" %s\n", _("- The NSClient service should be running on the server to get any information"));
695 printf (" %s\n", "(http://nsclient.ready2run.nl)."); 726 printf (" %s\n", "(http://nsclient.ready2run.nl).");