1 /*****************************************************************************
3 * Nagios check_nt plugin
6 * Copyright (c) 2000-2002 Yves Rubin (rubiyz@yahoo.com)
7 * Copyright (c) 2003-2007 Nagios Plugins Development Team
11 * This file contains the check_nt plugin
13 * This plugin collects data from the NSClient service running on a
14 * Windows NT/2000/XP/2003 server.
15 * This plugin requires NSClient software to run on NT
16 * (http://nsclient.ready2run.nl/)
19 * This program is free software: you can redistribute it and/or modify
20 * it under the terms of the GNU General Public License as published by
21 * the Free Software Foundation, either version 3 of the License, or
22 * (at your option) any later version.
24 * This program is distributed in the hope that it will be useful,
25 * but WITHOUT ANY WARRANTY; without even the implied warranty of
26 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
27 * GNU General Public License for more details.
29 * You should have received a copy of the GNU General Public License
30 * along with this program. If not, see <http://www.gnu.org/licenses/>.
33 *****************************************************************************/
35 const char *progname
= "check_nt";
36 const char *copyright
= "2000-2007";
37 const char *email
= "nagiosplug-devel@lists.sourceforge.net";
62 char *server_address
=NULL
;
63 char *volume_name
=NULL
;
65 char *value_list
=NULL
;
66 char *req_password
=NULL
;
67 unsigned long lvalue_list
[MAX_VALUE_LIST
];
68 unsigned long warning_value
=0L;
69 unsigned long critical_value
=0L;
70 int check_warning_value
=FALSE
;
71 int check_critical_value
=FALSE
;
72 enum checkvars vars_to_check
= CHECK_NONE
;
75 char recv_buffer
[MAX_INPUT_BUFFER
];
77 void fetch_data (const char* address
, int port
, const char* sendb
);
78 int process_arguments(int, char **);
79 void preparelist(char *string
);
80 int strtoularray(unsigned long *array
, char *string
, const char *delim
);
81 void print_help(void);
82 void print_usage(void);
84 int main(int argc
, char **argv
){
86 /* should be int result = STATE_UNKNOWN; */
88 int return_code
= STATE_UNKNOWN
;
89 char *send_buffer
=NULL
;
90 char *output_message
=NULL
;
92 char *temp_string
=NULL
;
93 char *temp_string_perf
=NULL
;
94 char *description
=NULL
,*counter_unit
= NULL
;
95 char *minval
= NULL
, *maxval
= NULL
, *errcvt
= NULL
;
96 char *fds
=NULL
, *tds
=NULL
;
98 double total_disk_space
=0;
99 double free_disk_space
=0;
100 double percent_used_space
=0;
101 double warning_used_space
=0;
102 double critical_used_space
=0;
103 double mem_commitLimit
=0;
104 double mem_commitByte
=0;
105 double fminval
= 0, fmaxval
= 0;
106 unsigned long utilization
;
107 unsigned long uptime
;
108 unsigned long age_in_minutes
;
109 double counter_value
= 0.0;
115 int isPercent
= FALSE
;
116 int allRight
= FALSE
;
118 setlocale (LC_ALL
, "");
119 bindtextdomain (PACKAGE
, LOCALEDIR
);
120 textdomain (PACKAGE
);
122 /* Parse extra opts if any */
123 argv
=np_extra_opts (&argc
, argv
, progname
);
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 fds
=strtok(recv_buffer
,"&");
219 tds
=strtok(NULL
,"&");
221 free_disk_space
=atof(fds
);
223 total_disk_space
=atof(tds
);
225 if (total_disk_space
>0 && free_disk_space
>=0) {
226 percent_used_space
= ((total_disk_space
- free_disk_space
) / total_disk_space
) * 100;
227 warning_used_space
= ((float)warning_value
/ 100) * total_disk_space
;
228 critical_used_space
= ((float)critical_value
/ 100) * total_disk_space
;
230 asprintf(&temp_string
,_("%s:\\ - total: %.2f Gb - used: %.2f Gb (%.0f%%) - free %.2f Gb (%.0f%%)"),
231 value_list
, total_disk_space
/ 1073741824, (total_disk_space
- free_disk_space
) / 1073741824,
232 percent_used_space
, free_disk_space
/ 1073741824, (free_disk_space
/ total_disk_space
)*100);
233 asprintf(&temp_string_perf
,_("'%s:\\ Used Space'=%.2fGb;%.2f;%.2f;0.00;%.2f"), value_list
,
234 (total_disk_space
- free_disk_space
) / 1073741824, warning_used_space
/ 1073741824,
235 critical_used_space
/ 1073741824, total_disk_space
/ 1073741824);
237 if(check_critical_value
==TRUE
&& percent_used_space
>= critical_value
)
238 return_code
=STATE_CRITICAL
;
239 else if (check_warning_value
==TRUE
&& percent_used_space
>= warning_value
)
240 return_code
=STATE_WARNING
;
242 return_code
=STATE_OK
;
244 output_message
= strdup (temp_string
);
245 perfdata
= temp_string_perf
;
247 output_message
= strdup (_("Free disk space : Invalid drive"));
248 return_code
=STATE_UNKNOWN
;
253 case CHECK_SERVICESTATE
:
254 case CHECK_PROCSTATE
:
256 if (value_list
==NULL
)
257 output_message
= strdup (_("No service/process specified"));
259 preparelist(value_list
); /* replace , between services with & to send the request */
260 asprintf(&send_buffer
,"%s&%u&%s&%s", req_password
,(vars_to_check
==CHECK_SERVICESTATE
)?5:6,
261 (show_all
==TRUE
) ? "ShowAll" : "ShowFail",value_list
);
262 fetch_data (server_address
, server_port
, send_buffer
);
263 return_code
=atoi(strtok(recv_buffer
,"&"));
264 temp_string
=strtok(NULL
,"&");
265 output_message
= strdup (temp_string
);
271 asprintf(&send_buffer
,"%s&7", req_password
);
272 fetch_data (server_address
, server_port
, send_buffer
);
273 mem_commitLimit
=atof(strtok(recv_buffer
,"&"));
274 mem_commitByte
=atof(strtok(NULL
,"&"));
275 percent_used_space
= (mem_commitByte
/ mem_commitLimit
) * 100;
276 warning_used_space
= ((float)warning_value
/ 100) * mem_commitLimit
;
277 critical_used_space
= ((float)critical_value
/ 100) * mem_commitLimit
;
279 /* Divisor should be 1048567, not 3044515, as we are measuring "Commit Charge" here,
280 which equals RAM + Pagefiles. */
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
,
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,
285 warning_used_space
/ 1048567, critical_used_space
/ 1048567, mem_commitLimit
/ 1048567);
287 return_code
=STATE_OK
;
288 if(check_critical_value
==TRUE
&& percent_used_space
>= critical_value
)
289 return_code
=STATE_CRITICAL
;
290 else if (check_warning_value
==TRUE
&& percent_used_space
>= warning_value
)
291 return_code
=STATE_WARNING
;
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
301 and some constraints have been introduced.
303 1) For the sake of simplicity of the code, perfdata information will only be
304 provided when the "description" field is added.
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%)
308 values automagically, as well the ¨%" sign to graph units.
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:
312 pages/s, packets transferred, etc.
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.
316 strange things will happen when you make graphs of your data.
319 if (value_list
== NULL
)
320 output_message
= strdup (_("No counter specified"));
323 preparelist (value_list
); /* replace , between services with & to send the request */
324 isPercent
= (strchr (value_list
, '%') != NULL
);
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
);
333 if (description
== NULL
)
334 asprintf (&output_message
, "%.f", counter_value
);
337 counter_unit
= strdup ("%");
341 if ((counter_unit
!= NULL
) && (!allRight
))
343 minval
= strtok (NULL
, "&");
344 maxval
= strtok (NULL
, "&");
346 /* All parameters specified. Let's check the numbers */
348 fminval
= (minval
!= NULL
) ? strtod (minval
, &errcvt
) : -1;
349 fmaxval
= (minval
!= NULL
) ? strtod (maxval
, &errcvt
) : -1;
351 if ((fminval
== 0) && (minval
== errcvt
))
352 output_message
= strdup (_("Minimum value contains non-numbers"));
355 if ((fmaxval
== 0) && (maxval
== errcvt
))
356 output_message
= strdup (_("Maximum value contains non-numbers"));
358 allRight
= TRUE
; /* Everything is OK. */
362 else if ((counter_unit
== NULL
) && (description
!= NULL
))
363 output_message
= strdup (_("No unit counter specified"));
367 /* Let's format the output string, finally... */
368 if (strstr(description
, "%") == NULL
) {
369 asprintf (&output_message
, "%s = %.2f %s", description
, counter_value
, counter_unit
);
371 /* has formatting, will segv if wrong */
372 asprintf (&output_message
, description
, counter_value
);
374 asprintf (&output_message
, "%s |", output_message
);
375 asprintf (&output_message
,"%s %s", output_message
,
376 fperfdata (description
, counter_value
,
377 counter_unit
, 1, warning_value
, 1, critical_value
,
378 (!(isPercent
) && (minval
!= NULL
)), fminval
,
379 (!(isPercent
) && (minval
!= NULL
)), fmaxval
));
383 if (critical_value
> warning_value
)
384 { /* Normal thresholds */
385 if (check_critical_value
== TRUE
&& counter_value
>= critical_value
)
386 return_code
= STATE_CRITICAL
;
387 else if (check_warning_value
== TRUE
&& counter_value
>= warning_value
)
388 return_code
= STATE_WARNING
;
390 return_code
= STATE_OK
;
393 { /* inverse thresholds */
394 return_code
= STATE_OK
;
395 if (check_critical_value
== TRUE
&& counter_value
<= critical_value
)
396 return_code
= STATE_CRITICAL
;
397 else if (check_warning_value
== TRUE
&& counter_value
<= warning_value
)
398 return_code
= STATE_WARNING
;
404 if (value_list
==NULL
)
405 output_message
= strdup (_("No counter specified"));
407 preparelist(value_list
); /* replace , between services with & to send the request */
408 asprintf(&send_buffer
,"%s&9&%s", req_password
,value_list
);
409 fetch_data (server_address
, server_port
, send_buffer
);
410 age_in_minutes
= atoi(strtok(recv_buffer
,"&"));
411 description
= strtok(NULL
,"&");
412 output_message
= strdup (description
);
414 if (critical_value
> warning_value
) { /* Normal thresholds */
415 if(check_critical_value
==TRUE
&& age_in_minutes
>= critical_value
)
416 return_code
=STATE_CRITICAL
;
417 else if (check_warning_value
==TRUE
&& age_in_minutes
>= warning_value
)
418 return_code
=STATE_WARNING
;
420 return_code
=STATE_OK
;
422 else { /* inverse thresholds */
423 if(check_critical_value
==TRUE
&& age_in_minutes
<= critical_value
)
424 return_code
=STATE_CRITICAL
;
425 else if (check_warning_value
==TRUE
&& age_in_minutes
<= warning_value
)
426 return_code
=STATE_WARNING
;
428 return_code
=STATE_OK
;
433 case CHECK_INSTANCES
:
434 if (value_list
==NULL
)
435 output_message
= strdup (_("No counter specified"));
437 asprintf(&send_buffer
,"%s&10&%s", req_password
,value_list
);
438 fetch_data (server_address
, server_port
, send_buffer
);
439 if (!strncmp(recv_buffer
,"ERROR",5)) {
440 printf("NSClient - %s\n",recv_buffer
);
443 asprintf(&output_message
,"%s",recv_buffer
);
444 return_code
=STATE_OK
;
450 usage4 (_("Please specify a variable to check"));
459 printf("%s\n",output_message
);
461 printf("%s | %s\n",output_message
,perfdata
);
467 /* process command-line arguments */
468 int process_arguments(int argc
, char **argv
){
472 static struct option longopts
[] =
474 {"port", required_argument
,0,'p'},
475 {"timeout", required_argument
,0,'t'},
476 {"critical", required_argument
,0,'c'},
477 {"warning", required_argument
,0,'w'},
478 {"variable", required_argument
,0,'v'},
479 {"hostname", required_argument
,0,'H'},
480 {"params", required_argument
,0,'l'},
481 {"secret", required_argument
,0,'s'},
482 {"display", required_argument
,0,'d'},
483 {"unknown-timeout", no_argument
, 0, 'u'},
484 {"version", no_argument
, 0,'V'},
485 {"help", no_argument
, 0,'h'},
489 /* no options were supplied */
490 if(argc
<2) return ERROR
;
492 /* backwards compatibility */
493 if (! is_option(argv
[1])) {
494 server_address
= strdup(argv
[1]);
500 for (c
=1;c
<argc
;c
++) {
501 if(strcmp("-to",argv
[c
])==0)
502 strcpy(argv
[c
],"-t");
503 else if (strcmp("-wv",argv
[c
])==0)
504 strcpy(argv
[c
],"-w");
505 else if (strcmp("-cv",argv
[c
])==0)
506 strcpy(argv
[c
],"-c");
510 c
= getopt_long(argc
,argv
,"+hVH:t:c:w:p:v:l:s:d:u",longopts
,&option
);
512 if (c
==-1||c
==EOF
||c
==1)
516 case '?': /* print short usage statement if args not parsable */
521 case 'V': /* version */
522 print_revision(progname
, NP_VERSION
);
524 case 'H': /* hostname */
525 server_address
= optarg
;
527 case 's': /* password */
528 req_password
= optarg
;
531 if (is_intnonneg(optarg
))
532 server_port
=atoi(optarg
);
534 die(STATE_UNKNOWN
,_("Server port must be an integer\n"));
539 if(!strcmp(optarg
,"CLIENTVERSION"))
540 vars_to_check
=CHECK_CLIENTVERSION
;
541 else if(!strcmp(optarg
,"CPULOAD"))
542 vars_to_check
=CHECK_CPULOAD
;
543 else if(!strcmp(optarg
,"UPTIME"))
544 vars_to_check
=CHECK_UPTIME
;
545 else if(!strcmp(optarg
,"USEDDISKSPACE"))
546 vars_to_check
=CHECK_USEDDISKSPACE
;
547 else if(!strcmp(optarg
,"SERVICESTATE"))
548 vars_to_check
=CHECK_SERVICESTATE
;
549 else if(!strcmp(optarg
,"PROCSTATE"))
550 vars_to_check
=CHECK_PROCSTATE
;
551 else if(!strcmp(optarg
,"MEMUSE"))
552 vars_to_check
=CHECK_MEMUSE
;
553 else if(!strcmp(optarg
,"COUNTER"))
554 vars_to_check
=CHECK_COUNTER
;
555 else if(!strcmp(optarg
,"FILEAGE"))
556 vars_to_check
=CHECK_FILEAGE
;
557 else if(!strcmp(optarg
,"INSTANCES"))
558 vars_to_check
=CHECK_INSTANCES
;
562 case 'l': /* value list */
565 case 'w': /* warning threshold */
566 warning_value
=strtoul(optarg
,NULL
,10);
567 check_warning_value
=TRUE
;
569 case 'c': /* critical threshold */
570 critical_value
=strtoul(optarg
,NULL
,10);
571 check_critical_value
=TRUE
;
573 case 'd': /* Display select for services */
574 if (!strcmp(optarg
,"SHOWALL"))
578 socket_timeout_state
=STATE_UNKNOWN
;
580 case 't': /* timeout */
581 socket_timeout
=atoi(optarg
);
582 if(socket_timeout
<=0)
587 if (server_address
== NULL
)
588 usage4 (_("You must provide a server address or host name"));
590 if (vars_to_check
==CHECK_NONE
)
593 if (req_password
== NULL
)
594 req_password
= strdup (_("None"));
601 void fetch_data (const char *address
, int port
, const char *sendb
) {
604 result
=process_tcp_request(address
, port
, sendb
, recv_buffer
,sizeof(recv_buffer
));
607 die (result
, _("could not fetch information from server\n"));
609 if (!strncmp(recv_buffer
,"ERROR",5))
610 die (STATE_UNKNOWN
, "NSClient - %s\n",recv_buffer
);
613 int strtoularray(unsigned long *array
, char *string
, const char *delim
) {
614 /* split a <delim> delimited string into a long array */
618 for (idx
=0;idx
<MAX_VALUE_LIST
;idx
++)
622 for(t1
= strtok(string
,delim
);t1
!= NULL
; t1
= strtok(NULL
, delim
)) {
623 if (is_numeric(t1
) && idx
<MAX_VALUE_LIST
) {
624 array
[idx
]=strtoul(t1
,NULL
,10);
632 void preparelist(char *string
) {
633 /* Replace all , with & which is the delimiter for the request */
636 for (i
= 0; (size_t)i
< strlen(string
); i
++)
637 if (string
[i
] == ',') {
644 void print_help(void)
646 print_revision(progname
, NP_VERSION
);
648 printf ("Copyright (c) 2000 Yves Rubin (rubiyz@yahoo.com)\n");
649 printf (COPYRIGHT
, copyright
, email
);
651 printf ("%s\n", _("This plugin collects data from the NSClient service running on a"));
652 printf ("%s\n", _("Windows NT/2000/XP/2003 server."));
658 printf (_(UT_HELP_VRSN
));
659 printf (_(UT_EXTRA_OPTS
));
661 printf ("%s\n", _("Options:"));
662 printf (" %s\n", "-H, --hostname=HOST");
663 printf (" %s\n", _("Name of the host to check"));
664 printf (" %s\n", "-p, --port=INTEGER");
665 printf (" %s", _("Optional port number (default: "));
666 printf ("%d)\n", PORT
);
667 printf (" %s\n", "-s, --secret=<password>");
668 printf (" %s\n", _("Password needed for the request"));
669 printf (" %s\n", "-w, --warning=INTEGER");
670 printf (" %s\n", _("Threshold which will result in a warning status"));
671 printf (" %s\n", "-c, --critical=INTEGER");
672 printf (" %s\n", _("Threshold which will result in a critical status"));
673 printf (" %s\n", "-t, --timeout=INTEGER");
674 printf (" %s", _("Seconds before connection attempt times out (default: "));
675 printf (" %s\n", "-l, --params=<parameters>");
676 printf (" %s", _("Parameters passed to specified check (see below)"));
677 printf (" %s\n", "-d, --display={SHOWALL}");
678 printf (" %s", _("Display options (currently only SHOWALL works)"));
679 printf (" %s\n", "-u, --unknown-timeout");
680 printf (" %s", _("Return UNKNOWN on timeouts"));
681 printf ("%d)\n", DEFAULT_SOCKET_TIMEOUT
);
682 printf (" %s\n", "-h, --help");
683 printf (" %s\n", _("Print this help screen"));
684 printf (" %s\n", "-V, --version");
685 printf (" %s\n", _("Print version information"));
686 printf (" %s\n", "-v, --variable=STRING");
687 printf (" %s\n\n", _("Variable to check"));
688 printf ("%s\n", _("Valid variables are:"));
689 printf (" %s", "CLIENTVERSION =");
690 printf (" %s\n", _("Get the NSClient version"));
691 printf (" %s\n", _("If -l <version> is specified, will return warning if versions differ."));
692 printf (" %s\n", "CPULOAD =");
693 printf (" %s\n", _("Average CPU load on last x minutes."));
694 printf (" %s\n", _("Request a -l parameter with the following syntax:"));
695 printf (" %s\n", _("-l <minutes range>,<warning threshold>,<critical threshold>."));
696 printf (" %s\n", _("<minute range> should be less than 24*60."));
697 printf (" %s\n", _("Thresholds are percentage and up to 10 requests can be done in one shot."));
698 printf (" %s\n", "ie: -l 60,90,95,120,90,95");
699 printf (" %s\n", "UPTIME =");
700 printf (" %s\n", _("Get the uptime of the machine."));
701 printf (" %s\n", _("No specific parameters. No warning or critical threshold"));
702 printf (" %s\n", "USEDDISKSPACE =");
703 printf (" %s\n", _("Size and percentage of disk use."));
704 printf (" %s\n", _("Request a -l parameter containing the drive letter only."));
705 printf (" %s\n", _("Warning and critical thresholds can be specified with -w and -c."));
706 printf (" %s\n", "MEMUSE =");
707 printf (" %s\n", _("Memory use."));
708 printf (" %s\n", _("Warning and critical thresholds can be specified with -w and -c."));
709 printf (" %s\n", "SERVICESTATE =");
710 printf (" %s\n", _("Check the state of one or several services."));
711 printf (" %s\n", _("Request a -l parameters with the following syntax:"));
712 printf (" %s\n", _("-l <service1>,<service2>,<service3>,..."));
713 printf (" %s\n", _("You can specify -d SHOWALL in case you want to see working services"));
714 printf (" %s\n", _("in the returned string."));
715 printf (" %s\n", "PROCSTATE =");
716 printf (" %s\n", _("Check if one or several process are running."));
717 printf (" %s\n", _("Same syntax as SERVICESTATE."));
718 printf (" %s\n", "COUNTER =");
719 printf (" %s\n", _("Check any performance counter of Windows NT/2000."));
720 printf (" %s\n", _("Request a -l parameters with the following syntax:"));
721 printf (" %s\n", _("-l \"\\\\<performance object>\\\\counter\",\"<description>"));
722 printf (" %s\n", _("The <description> parameter is optional and is given to a printf "));
723 printf (" %s\n", _("output command which requires a float parameter."));
724 printf (" %s\n", _("If <description> does not include \"%%\", it is used as a label."));
725 printf (" %s\n", _("Some examples:"));
726 printf (" %s\n", "\"Paging file usage is %%.2f %%%%\"");
727 printf (" %s\n", "\"%%.f %%%% paging file used.\"");
728 printf (" %s\n", "INSTANCES =");
729 printf (" %s\n", _("Check any performance counter object of Windows NT/2000."));
730 printf (" %s\n", _("Syntax: check_nt -H <hostname> -p <port> -v INSTANCES -l <counter object>"));
731 printf (" %s\n", _("<counter object> is a Windows Perfmon Counter object (eg. Process),"));
732 printf (" %s\n", _("if it is two words, it should be enclosed in quotes"));
733 printf (" %s\n", _("The returned results will be a comma-separated list of instances on "));
734 printf (" %s\n", _(" the selected computer for that object."));
735 printf (" %s\n", _("The purpose of this is to be run from command line to determine what instances"));
736 printf (" %s\n", _(" are available for monitoring without having to log onto the Windows server"));
737 printf (" %s\n", _(" to run Perfmon directly."));
738 printf (" %s\n", _("It can also be used in scripts that automatically create Nagios service"));
739 printf (" %s\n", _(" configuration files."));
740 printf (" %s\n", _("Some examples:"));
741 printf (" %s\n\n", _("check_nt -H 192.168.1.1 -p 1248 -v INSTANCES -l Process"));
743 printf ("%s\n", _("Notes:"));
744 printf (" %s\n", _("- The NSClient service should be running on the server to get any information"));
745 printf (" %s\n", "(http://nsclient.ready2run.nl).");
746 printf (" %s\n", _("- Critical thresholds should be lower than warning thresholds"));
747 printf (" %s\n", _("- Default port 1248 is sometimes in use by other services. The error"));
748 printf (" %s\n", _("output when this happens contains \"Cannot map xxxxx to protocol number\"."));
749 printf (" %s\n", _("One fix for this is to change the port to something else on check_nt "));
750 printf (" %s\n", _("and on the client service it\'s connecting to."));
752 printf (" -%s", _(UT_EXTRA_OPTS_NOTES
));
755 printf (_(UT_SUPPORT
));
760 void print_usage(void)
762 printf (_("Usage:"));
763 printf ("%s -H host -v variable [-p port] [-w warning] [-c critical]\n",progname
);
764 printf ("[-l params] [-d SHOWALL] [-u] [-t timeout]\n");