1 /******************************************************************************
3 * Nagios check_nt plugin
6 * Copyright (c) 2000-2002 Yves Rubin (rubiyz@yahoo.com)
7 * Copyright (c) 2003-2006 nagios-plugins team
9 * Last Modified: $Date$
13 * This file contains the check_nt plugin
15 * This plugin collects data from the NSClient service running on a
16 * Windows NT/2000/XP/2003 server.
17 * This requires NSClient software to run on NT (http://nsclient.ready2run.nl/)
19 * License Information:
21 * This program is free software; you can redistribute it and/or modify
22 * it under the terms of the GNU General Public License as published by
23 * the Free Software Foundation; either version 2 of the License, or
24 * (at your option) any later version.
26 * This program is distributed in the hope that it will be useful,
27 * but WITHOUT ANY WARRANTY; without even the implied warranty of
28 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
29 * GNU General Public License for more details.
31 * You should have received a copy of the GNU General Public License
32 * along with this program; if not, write to the Free Software
33 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
37 *****************************************************************************/
39 const char *progname
= "check_nt";
40 const char *revision
= "$Revision$";
41 const char *copyright
= "2003-2006";
42 const char *email
= "nagiosplug-devel@lists.sourceforge.net";
66 char *server_address
=NULL
;
67 char *volume_name
=NULL
;
69 char *value_list
=NULL
;
70 char *req_password
=NULL
;
71 unsigned long lvalue_list
[MAX_VALUE_LIST
];
72 unsigned long warning_value
=0L;
73 unsigned long critical_value
=0L;
74 int check_warning_value
=FALSE
;
75 int check_critical_value
=FALSE
;
76 enum checkvars vars_to_check
= CHECK_NONE
;
79 char recv_buffer
[MAX_INPUT_BUFFER
];
81 void fetch_data (const char* address
, int port
, const char* sendb
);
82 int process_arguments(int, char **);
83 void preparelist(char *string
);
84 int strtoularray(unsigned long *array
, char *string
, const char *delim
);
85 void print_help(void);
86 void print_usage(void);
88 int main(int argc
, char **argv
){
90 /* should be int result = STATE_UNKNOWN; */
92 int return_code
= STATE_UNKNOWN
;
93 char *send_buffer
=NULL
;
94 char *output_message
=NULL
;
96 char *temp_string
=NULL
;
97 char *temp_string_perf
=NULL
;
98 char *description
=NULL
,*counter_unit
= NULL
;
99 char *minval
= NULL
, *maxval
= NULL
, *errcvt
= NULL
;
101 double total_disk_space
=0;
102 double free_disk_space
=0;
103 double percent_used_space
=0;
104 double warning_used_space
=0;
105 double critical_used_space
=0;
106 double mem_commitLimit
=0;
107 double mem_commitByte
=0;
108 double fminval
= 0, fmaxval
= 0;
109 unsigned long utilization
;
110 unsigned long uptime
;
111 unsigned long age_in_minutes
;
112 double counter_value
= 0.0;
118 int isPercent
= FALSE
;
119 int allRight
= FALSE
;
121 setlocale (LC_ALL
, "");
122 bindtextdomain (PACKAGE
, LOCALEDIR
);
123 textdomain (PACKAGE
);
125 if(process_arguments(argc
,argv
) == ERROR
)
126 usage4 (_("Could not parse arguments"));
128 /* initialize alarm signal handling */
129 signal(SIGALRM
,socket_timeout_alarm_handler
);
131 /* set socket timeout */
132 alarm(socket_timeout
);
134 switch (vars_to_check
) {
136 case CHECK_CLIENTVERSION
:
138 asprintf(&send_buffer
, "%s&1", req_password
);
139 fetch_data (server_address
, server_port
, send_buffer
);
140 if (value_list
!= NULL
&& strcmp(recv_buffer
, value_list
) != 0) {
141 asprintf (&output_message
, _("Wrong client version - running: %s, required: %s"), recv_buffer
, value_list
);
142 return_code
= STATE_WARNING
;
144 asprintf (&output_message
, "%s", recv_buffer
);
145 return_code
= STATE_OK
;
151 if (value_list
==NULL
)
152 output_message
= strdup (_("missing -l parameters"));
153 else if (strtoularray(lvalue_list
,value_list
,",")==FALSE
)
154 output_message
= strdup (_("wrong -l parameter."));
156 /* -l parameters is present with only integers */
157 return_code
=STATE_OK
;
158 temp_string
= strdup (_("CPU Load"));
159 temp_string_perf
= strdup (" ");
161 /* loop until one of the parameters is wrong or not present */
162 while (lvalue_list
[0+offset
]> (unsigned long)0 &&
163 lvalue_list
[0+offset
]<=(unsigned long)17280 &&
164 lvalue_list
[1+offset
]> (unsigned long)0 &&
165 lvalue_list
[1+offset
]<=(unsigned long)100 &&
166 lvalue_list
[2+offset
]> (unsigned long)0 &&
167 lvalue_list
[2+offset
]<=(unsigned long)100) {
169 /* Send request and retrieve data */
170 asprintf(&send_buffer
,"%s&2&%lu",req_password
,lvalue_list
[0+offset
]);
171 fetch_data (server_address
, server_port
, send_buffer
);
173 utilization
=strtoul(recv_buffer
,NULL
,10);
175 /* Check if any of the request is in a warning or critical state */
176 if(utilization
>= lvalue_list
[2+offset
])
177 return_code
=STATE_CRITICAL
;
178 else if(utilization
>= lvalue_list
[1+offset
] && return_code
<STATE_WARNING
)
179 return_code
=STATE_WARNING
;
181 asprintf(&output_message
,_(" %lu%% (%lu min average)"), utilization
, lvalue_list
[0+offset
]);
182 asprintf(&temp_string
,"%s%s",temp_string
,output_message
);
183 asprintf(&perfdata
,_(" '%lu min avg Load'=%lu%%;%lu;%lu;0;100"), lvalue_list
[0+offset
], utilization
,
184 lvalue_list
[1+offset
], lvalue_list
[2+offset
]);
185 asprintf(&temp_string_perf
,"%s%s",temp_string_perf
,perfdata
);
186 offset
+=3; /* move across the array */
189 if (strlen(temp_string
)>10) { /* we had at least one loop */
190 output_message
= strdup (temp_string
);
191 perfdata
= temp_string_perf
;
193 output_message
= strdup (_("not enough values for -l parameters"));
199 asprintf(&send_buffer
, "%s&3", req_password
);
200 fetch_data (server_address
, server_port
, send_buffer
);
201 uptime
=strtoul(recv_buffer
,NULL
,10);
202 updays
= uptime
/ 86400;
203 uphours
= (uptime
% 86400) / 3600;
204 upminutes
= ((uptime
% 86400) % 3600) / 60;
205 asprintf(&output_message
,_("System Uptime - %u day(s) %u hour(s) %u minute(s)"),updays
,uphours
, upminutes
);
206 return_code
=STATE_OK
;
209 case CHECK_USEDDISKSPACE
:
211 if (value_list
==NULL
)
212 output_message
= strdup (_("missing -l parameters"));
213 else if (strlen(value_list
)!=1)
214 output_message
= strdup (_("wrong -l argument"));
216 asprintf(&send_buffer
,"%s&4&%s", req_password
, value_list
);
217 fetch_data (server_address
, server_port
, send_buffer
);
218 free_disk_space
=atof(strtok(recv_buffer
,"&"));
219 total_disk_space
=atof(strtok(NULL
,"&"));
220 percent_used_space
= ((total_disk_space
- free_disk_space
) / total_disk_space
) * 100;
221 warning_used_space
= ((float)warning_value
/ 100) * total_disk_space
;
222 critical_used_space
= ((float)critical_value
/ 100) * total_disk_space
;
224 if (free_disk_space
>=0) {
225 asprintf(&temp_string
,_("%s:\\ - total: %.2f Gb - used: %.2f Gb (%.0f%%) - free %.2f Gb (%.0f%%)"),
226 value_list
, total_disk_space
/ 1073741824, (total_disk_space
- free_disk_space
) / 1073741824,
227 percent_used_space
, free_disk_space
/ 1073741824, (free_disk_space
/ total_disk_space
)*100);
228 asprintf(&temp_string_perf
,_("'%s:\\ Used Space'=%.2fGb;%.2f;%.2f;0.00;%.2f"), value_list
,
229 (total_disk_space
- free_disk_space
) / 1073741824, warning_used_space
/ 1073741824,
230 critical_used_space
/ 1073741824, total_disk_space
/ 1073741824);
232 if(check_critical_value
==TRUE
&& percent_used_space
>= critical_value
)
233 return_code
=STATE_CRITICAL
;
234 else if (check_warning_value
==TRUE
&& percent_used_space
>= warning_value
)
235 return_code
=STATE_WARNING
;
237 return_code
=STATE_OK
;
239 output_message
= strdup (temp_string
);
240 perfdata
= temp_string_perf
;
242 output_message
= strdup (_("Free disk space : Invalid drive "));
243 return_code
=STATE_UNKNOWN
;
248 case CHECK_SERVICESTATE
:
249 case CHECK_PROCSTATE
:
251 if (value_list
==NULL
)
252 output_message
= strdup (_("No service/process specified"));
254 preparelist(value_list
); /* replace , between services with & to send the request */
255 asprintf(&send_buffer
,"%s&%u&%s&%s", req_password
,(vars_to_check
==CHECK_SERVICESTATE
)?5:6,
256 (show_all
==TRUE
) ? "ShowAll" : "ShowFail",value_list
);
257 fetch_data (server_address
, server_port
, send_buffer
);
258 return_code
=atoi(strtok(recv_buffer
,"&"));
259 temp_string
=strtok(NULL
,"&");
260 output_message
= strdup (temp_string
);
266 asprintf(&send_buffer
,"%s&7", req_password
);
267 fetch_data (server_address
, server_port
, send_buffer
);
268 mem_commitLimit
=atof(strtok(recv_buffer
,"&"));
269 mem_commitByte
=atof(strtok(NULL
,"&"));
270 percent_used_space
= (mem_commitByte
/ mem_commitLimit
) * 100;
271 warning_used_space
= ((float)warning_value
/ 100) * mem_commitLimit
;
272 critical_used_space
= ((float)critical_value
/ 100) * mem_commitLimit
;
274 /* Divisor should be 1048567, not 3044515, as we are measuring "Commit Charge" here,
275 which equals RAM + Pagefiles. */
276 asprintf(&output_message
,_("Memory usage: total:%.2f Mb - used: %.2f Mb (%.0f%%) - free: %.2f Mb (%.0f%%)"),
277 mem_commitLimit
/ 1048567, mem_commitByte
/ 1048567, percent_used_space
,
278 (mem_commitLimit
- mem_commitByte
) / 1048567, (mem_commitLimit
- mem_commitByte
) / mem_commitLimit
* 100);
279 asprintf(&perfdata
,_("'Memory usage'=%.2fMb;%.2f;%.2f;0.00;%.2f"), mem_commitByte
/ 1048567,
280 warning_used_space
/ 1048567, critical_used_space
/ 1048567, mem_commitLimit
/ 1048567);
282 return_code
=STATE_OK
;
283 if(check_critical_value
==TRUE
&& percent_used_space
>= critical_value
)
284 return_code
=STATE_CRITICAL
;
285 else if (check_warning_value
==TRUE
&& percent_used_space
>= warning_value
)
286 return_code
=STATE_WARNING
;
294 CHECK_COUNTER has been modified to provide extensive perfdata information.
295 In order to do this, some modifications have been done to the code
296 and some constraints have been introduced.
298 1) For the sake of simplicity of the code, perfdata information will only be
299 provided when the "description" field is added.
301 2) If the counter you're going to measure is percent-based, the code will detect
302 the percent sign in its name and will attribute minimum (0%) and maximum (100%)
303 values automagically, as well the ¨%" sign to graph units.
305 3) OTOH, if the counter is "absolute", you'll have to provide the following
306 the counter unit - that is, the dimensions of the counter you're getting. Examples:
307 pages/s, packets transferred, etc.
309 4) If you want, you may provide the minimum and maximum values to expect. They aren't mandatory,
310 but once specified they MUST have the same order of magnitude and units of -w and -c; otherwise.
311 strange things will happen when you make graphs of your data.
314 if (value_list
== NULL
)
315 output_message
= strdup (_("No counter specified"));
318 preparelist (value_list
); /* replace , between services with & to send the request */
319 isPercent
= (strchr (value_list
, '%') != NULL
);
321 strtok (value_list
, "&"); /* burn the first parameters */
322 description
= strtok (NULL
, "&");
323 counter_unit
= strtok (NULL
, "&");
324 asprintf (&send_buffer
, "%s&8&%s", req_password
, value_list
);
325 fetch_data (server_address
, server_port
, send_buffer
);
326 counter_value
= atof (recv_buffer
);
329 if (description
== NULL
)
330 asprintf (&output_message
, "%.f", counter_value
);
333 counter_unit
= strdup ("%");
337 if ((counter_unit
!= NULL
) && (!allRight
))
339 minval
= strtok (NULL
, "&");
340 maxval
= strtok (NULL
, "&");
342 /* All parameters specified. Let's check the numbers */
344 fminval
= (minval
!= NULL
) ? strtod (minval
, &errcvt
) : -1;
345 fmaxval
= (minval
!= NULL
) ? strtod (maxval
, &errcvt
) : -1;
347 if ((fminval
== 0) && (minval
== errcvt
))
348 output_message
= strdup (_("Minimum value contains non-numbers"));
351 if ((fmaxval
== 0) && (maxval
== errcvt
))
352 output_message
= strdup (_("Maximum value contains non-numbers"));
354 allRight
= TRUE
; /* Everything is OK. */
358 else if ((counter_unit
== NULL
) && (description
!= NULL
))
359 output_message
= strdup (_("No unit counter specified"));
363 /* Let's format the output string, finally... */
364 if (strstr(description
, "%") == NULL
) {
365 asprintf (&output_message
, "%s = %.2f %s", description
, counter_value
, counter_unit
);
367 /* has formatting, will segv if wrong */
368 asprintf (&output_message
, description
, counter_value
);
370 asprintf (&output_message
, "%s |", output_message
);
371 asprintf (&output_message
,"%s %s", output_message
,
372 fperfdata (description
, counter_value
,
373 counter_unit
, 1, warning_value
, 1, critical_value
,
374 (!(isPercent
) && (minval
!= NULL
)), fminval
,
375 (!(isPercent
) && (minval
!= NULL
)), fmaxval
));
379 if (critical_value
> warning_value
)
380 { /* Normal thresholds */
381 if (check_critical_value
== TRUE
&& counter_value
>= critical_value
)
382 return_code
= STATE_CRITICAL
;
383 else if (check_warning_value
== TRUE
&& counter_value
>= warning_value
)
384 return_code
= STATE_WARNING
;
386 return_code
= STATE_OK
;
389 { /* inverse thresholds */
390 return_code
= STATE_OK
;
391 if (check_critical_value
== TRUE
&& counter_value
<= critical_value
)
392 return_code
= STATE_CRITICAL
;
393 else if (check_warning_value
== TRUE
&& counter_value
<= warning_value
)
394 return_code
= STATE_WARNING
;
400 if (value_list
==NULL
)
401 output_message
= strdup (_("No counter specified"));
403 preparelist(value_list
); /* replace , between services with & to send the request */
404 asprintf(&send_buffer
,"%s&9&%s", req_password
,value_list
);
405 fetch_data (server_address
, server_port
, send_buffer
);
406 age_in_minutes
= atoi(strtok(recv_buffer
,"&"));
407 description
= strtok(NULL
,"&");
408 output_message
= strdup (description
);
410 if (critical_value
> warning_value
) { /* Normal thresholds */
411 if(check_critical_value
==TRUE
&& age_in_minutes
>= critical_value
)
412 return_code
=STATE_CRITICAL
;
413 else if (check_warning_value
==TRUE
&& age_in_minutes
>= warning_value
)
414 return_code
=STATE_WARNING
;
416 return_code
=STATE_OK
;
418 else { /* inverse thresholds */
419 if(check_critical_value
==TRUE
&& age_in_minutes
<= critical_value
)
420 return_code
=STATE_CRITICAL
;
421 else if (check_warning_value
==TRUE
&& age_in_minutes
<= warning_value
)
422 return_code
=STATE_WARNING
;
424 return_code
=STATE_OK
;
431 usage4 (_("Please specify a variable to check"));
440 printf("%s\n",output_message
);
442 printf("%s | %s\n",output_message
,perfdata
);
448 /* process command-line arguments */
449 int process_arguments(int argc
, char **argv
){
453 static struct option longopts
[] =
455 {"port", required_argument
,0,'p'},
456 {"timeout", required_argument
,0,'t'},
457 {"critical", required_argument
,0,'c'},
458 {"warning", required_argument
,0,'w'},
459 {"variable", required_argument
,0,'v'},
460 {"hostname", required_argument
,0,'H'},
461 {"version", no_argument
, 0,'V'},
462 {"help", no_argument
, 0,'h'},
466 /* no options were supplied */
467 if(argc
<2) return ERROR
;
469 /* backwards compatibility */
470 if (! is_option(argv
[1])) {
471 server_address
= strdup(argv
[1]);
477 for (c
=1;c
<argc
;c
++) {
478 if(strcmp("-to",argv
[c
])==0)
479 strcpy(argv
[c
],"-t");
480 else if (strcmp("-wv",argv
[c
])==0)
481 strcpy(argv
[c
],"-w");
482 else if (strcmp("-cv",argv
[c
])==0)
483 strcpy(argv
[c
],"-c");
487 c
= getopt_long(argc
,argv
,"+hVH:t:c:w:p:v:l:s:d:",longopts
,&option
);
489 if (c
==-1||c
==EOF
||c
==1)
494 case '?': /* print short usage statement if args not parsable */
499 case 'V': /* version */
500 print_revision(progname
,revision
);
502 case 'H': /* hostname */
503 if (server_address
) free(server_address
);
504 server_address
= optarg
;
506 case 's': /* password */
507 req_password
= optarg
;
510 if (is_intnonneg(optarg
))
511 server_port
=atoi(optarg
);
513 die(STATE_UNKNOWN
,_("Server port must be an integer\n"));
518 if(!strcmp(optarg
,"CLIENTVERSION"))
519 vars_to_check
=CHECK_CLIENTVERSION
;
520 else if(!strcmp(optarg
,"CPULOAD"))
521 vars_to_check
=CHECK_CPULOAD
;
522 else if(!strcmp(optarg
,"UPTIME"))
523 vars_to_check
=CHECK_UPTIME
;
524 else if(!strcmp(optarg
,"USEDDISKSPACE"))
525 vars_to_check
=CHECK_USEDDISKSPACE
;
526 else if(!strcmp(optarg
,"SERVICESTATE"))
527 vars_to_check
=CHECK_SERVICESTATE
;
528 else if(!strcmp(optarg
,"PROCSTATE"))
529 vars_to_check
=CHECK_PROCSTATE
;
530 else if(!strcmp(optarg
,"MEMUSE"))
531 vars_to_check
=CHECK_MEMUSE
;
532 else if(!strcmp(optarg
,"COUNTER"))
533 vars_to_check
=CHECK_COUNTER
;
534 else if(!strcmp(optarg
,"FILEAGE"))
535 vars_to_check
=CHECK_FILEAGE
;
539 case 'l': /* value list */
542 case 'w': /* warning threshold */
543 warning_value
=strtoul(optarg
,NULL
,10);
544 check_warning_value
=TRUE
;
546 case 'c': /* critical threshold */
547 critical_value
=strtoul(optarg
,NULL
,10);
548 check_critical_value
=TRUE
;
550 case 'd': /* Display select for services */
551 if (!strcmp(optarg
,"SHOWALL"))
554 case 't': /* timeout */
555 socket_timeout
=atoi(optarg
);
556 if(socket_timeout
<=0)
562 if (vars_to_check
==CHECK_NONE
)
565 if (req_password
== NULL
)
566 req_password
= strdup (_("None"));
573 void fetch_data (const char *address
, int port
, const char *sendb
) {
576 result
=process_tcp_request(address
, port
, sendb
, recv_buffer
,sizeof(recv_buffer
));
579 die (result
, _("could not fetch information from server\n"));
581 if (!strncmp(recv_buffer
,"ERROR",5))
582 die (STATE_UNKNOWN
, "NSClient - %s\n",recv_buffer
);
585 int strtoularray(unsigned long *array
, char *string
, const char *delim
) {
586 /* split a <delim> delimited string into a long array */
590 for (idx
=0;idx
<MAX_VALUE_LIST
;idx
++)
594 for(t1
= strtok(string
,delim
);t1
!= NULL
; t1
= strtok(NULL
, delim
)) {
595 if (is_numeric(t1
) && idx
<MAX_VALUE_LIST
) {
596 array
[idx
]=strtoul(t1
,NULL
,10);
604 void preparelist(char *string
) {
605 /* Replace all , with & which is the delimiter for the request */
608 for (i
= 0; (size_t)i
< strlen(string
); i
++)
609 if (string
[i
] == ',') {
616 void print_help(void)
618 print_revision(progname
,revision
);
620 printf ("Copyright (c) 2000 Yves Rubin (rubiyz@yahoo.com)\n");
621 printf (COPYRIGHT
, copyright
, email
);
623 printf ("%s\n", _("This plugin collects data from the NSClient service running on a"));
624 printf ("%s\n", _("Windows NT/2000/XP/2003 server."));
630 printf (_(UT_HELP_VRSN
));
632 printf ("%s\n", _("Options:"));
633 printf (" %s\n", "-H, --hostname=HOST");
634 printf (" %s\n", _("Name of the host to check"));
635 printf (" %s\n", "-p, --port=INTEGER");
636 printf (" %s", _("Optional port number (default: "));
637 printf ("%d)\n", PORT
);
638 printf (" %s\n", "-s <password>");
639 printf (" %s\n", _("Password needed for the request"));
640 printf (" %s\n", "-w, --warning=INTEGER");
641 printf (" %s\n", _("Threshold which will result in a warning status"));
642 printf (" %s\n", "-c, --critical=INTEGER");
643 printf (" %s\n", _("Threshold which will result in a critical status"));
644 printf (" %s\n", "-t, --timeout=INTEGER");
645 printf (" %s", _("Seconds before connection attempt times out (default: "));
646 printf ("%d)\n", DEFAULT_SOCKET_TIMEOUT
);
647 printf (" %s\n", "-h, --help");
648 printf (" %s\n", _("Print this help screen"));
649 printf (" %s\n", "-V, --version");
650 printf (" %s\n", _("Print version information"));
651 printf (" %s\n", "-v, --variable=STRING");
652 printf (" %s\n\n", _("Variable to check"));
653 printf ("%s\n", _("Valid variables are:"));
654 printf (" %s", "CLIENTVERSION =");
655 printf (" %s\n", _("Get the NSClient version"));
656 printf (" %s\n", _("If -l <version> is specified, will return warning if versions differ."));
657 printf (" %s\n", "CPULOAD =");
658 printf (" %s\n", _("Average CPU load on last x minutes."));
659 printf (" %s\n", _("Request a -l parameter with the following syntax:"));
660 printf (" %s\n", _("-l <minutes range>,<warning threshold>,<critical threshold>."));
661 printf (" %s\n", _("<minute range> should be less than 24*60."));
662 printf (" %s\n", _("Thresholds are percentage and up to 10 requests can be done in one shot."));
663 printf (" %s\n", "ie: -l 60,90,95,120,90,95");
664 printf (" %s\n", "UPTIME =");
665 printf (" %s\n", _("Get the uptime of the machine."));
666 printf (" %s\n", _("No specific parameters. No warning or critical threshold"));
667 printf (" %s\n", "USEDDISKSPACE =");
668 printf (" %s\n", _("Size and percentage of disk use."));
669 printf (" %s\n", _("Request a -l parameter containing the drive letter only."));
670 printf (" %s\n", _("Warning and critical thresholds can be specified with -w and -c."));
671 printf (" %s\n", "MEMUSE =");
672 printf (" %s\n", _("Memory use."));
673 printf (" %s\n", _("Warning and critical thresholds can be specified with -w and -c."));
674 printf (" %s\n,", "SERVICESTATE =");
675 printf (" %s\n", _("Check the state of one or several services."));
676 printf (" %s\n", _("Request a -l parameters with the following syntax:"));
677 printf (" %s\n", _("-l <service1>,<service2>,<service3>,..."));
678 printf (" %s\n", _("You can specify -d SHOWALL in case you want to see working services"));
679 printf (" %s\n", _("in the returned string."));
680 printf (" %s\n", "PROCSTATE =");
681 printf (" %s\n", _("Check if one or several process are running."));
682 printf (" %s\n", _("Same syntax as SERVICESTATE."));
683 printf (" %s\n", "COUNTER =");
684 printf (" %s\n", _("Check any performance counter of Windows NT/2000."));
685 printf (" %s\n", _("Request a -l parameters with the following syntax:"));
686 printf (" %s\n", _("-l \"\\\\<performance object>\\\\counter\",\"<description>"));
687 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."));
689 printf (" %s\n\n", _("If <description> does not include \"%%\", it is used as a label."));
690 printf (" %s\n", _("Some examples:"));
691 printf (" %s\n", "\"Paging file usage is %%.2f %%%%\"");
692 printf (" %s\n\n", "\"%%.f %%%% paging file used.\"");
693 printf (_("Notes:"));
694 printf (" %s\n", _("- The NSClient service should be running on the server to get any information"));
695 printf (" %s\n", "(http://nsclient.ready2run.nl).");
696 printf (" %s\n", _("- Critical thresholds should be lower than warning thresholds"));
697 printf (" %s\n", _("- Default port 1248 is sometimes in use by other services. The error"));
698 printf (" %s\n", _("output when this happens contains \"Cannot map xxxxx to protocol number\"."));
699 printf (" %s\n", _("One fix for this is to change the port to something else on check_nt "));
700 printf (" %s\n", _("and on the client service it\'s connecting to."));
705 void print_usage(void)
707 printf (_("Usage:"));
708 printf ("%s -H host -v variable [-p port] [-w warning] [-c critical]",progname
);
709 printf ("[-l params] [-d SHOWALL] [-t timeout]\n");