check_nt.c 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617
  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. *****************************************************************************/
  30. #include "common.h"
  31. #include "netutils.h"
  32. #include "utils.h"
  33. enum checkvars {
  34. CHECK_NONE,
  35. CHECK_CLIENTVERSION,
  36. CHECK_CPULOAD,
  37. CHECK_UPTIME,
  38. CHECK_USEDDISKSPACE,
  39. CHECK_SERVICESTATE,
  40. CHECK_PROCSTATE,
  41. CHECK_MEMUSE,
  42. CHECK_COUNTER,
  43. CHECK_FILEAGE
  44. };
  45. enum {
  46. MAX_VALUE_LIST = 30,
  47. PORT = 1248
  48. };
  49. char *server_address=NULL;
  50. char *volume_name=NULL;
  51. int server_port=PORT;
  52. char *value_list=NULL;
  53. char *req_password=NULL;
  54. unsigned long lvalue_list[MAX_VALUE_LIST];
  55. unsigned long warning_value=0L;
  56. unsigned long critical_value=0L;
  57. int check_warning_value=FALSE;
  58. int check_critical_value=FALSE;
  59. enum checkvars vars_to_check = CHECK_NONE;
  60. int show_all=FALSE;
  61. const char *progname = "check_nt";
  62. char recv_buffer[MAX_INPUT_BUFFER];
  63. void fetch_data (const char* address, int port, const char* sendb);
  64. int process_arguments(int, char **);
  65. void preparelist(char *string);
  66. int strtoularray(unsigned long *array, char *string, const char *delim);
  67. void print_help(void);
  68. void print_usage(void);
  69. int main(int argc, char **argv){
  70. int return_code = STATE_UNKNOWN;
  71. char *send_buffer=NULL;
  72. char *output_message=NULL;
  73. char *perfdata=NULL;
  74. char *temp_string=NULL;
  75. char *temp_string_perf=NULL;
  76. char *description=NULL;
  77. double total_disk_space=0;
  78. double free_disk_space=0;
  79. double percent_used_space=0;
  80. double warning_used_space=0;
  81. double critical_used_space=0;
  82. double mem_commitLimit=0;
  83. double mem_commitByte=0;
  84. unsigned long utilization;
  85. unsigned long uptime;
  86. unsigned long age_in_minutes;
  87. double counter_value;
  88. int offset=0;
  89. int updays=0;
  90. int uphours=0;
  91. int upminutes=0;
  92. setlocale (LC_ALL, "");
  93. bindtextdomain (PACKAGE, LOCALEDIR);
  94. textdomain (PACKAGE);
  95. if(process_arguments(argc,argv)==ERROR)
  96. usage(_("Could not parse arguments\n"));
  97. /* initialize alarm signal handling */
  98. signal(SIGALRM,socket_timeout_alarm_handler);
  99. /* set socket timeout */
  100. alarm(socket_timeout);
  101. switch (vars_to_check) {
  102. case CHECK_CLIENTVERSION:
  103. asprintf(&send_buffer, "%s&1", req_password);
  104. fetch_data (server_address, server_port, send_buffer);
  105. if (value_list != NULL && strcmp(recv_buffer, value_list) != 0) {
  106. asprintf (&output_message, _("Wrong client version - running: %s, required: %s"), recv_buffer, value_list);
  107. return_code = STATE_WARNING;
  108. } else {
  109. asprintf (&output_message, "%s", recv_buffer);
  110. return_code = STATE_OK;
  111. }
  112. break;
  113. case CHECK_CPULOAD:
  114. if (value_list==NULL)
  115. output_message = strdup (_("missing -l parameters"));
  116. else if (strtoularray(lvalue_list,value_list,",")==FALSE)
  117. output_message = strdup (_("wrong -l parameter."));
  118. else {
  119. /* -l parameters is present with only integers */
  120. return_code=STATE_OK;
  121. temp_string = strdup (_("CPU Load"));
  122. temp_string_perf = strdup (_(" "));
  123. /* loop until one of the parameters is wrong or not present */
  124. while (lvalue_list[0+offset]> (unsigned long)0 &&
  125. lvalue_list[0+offset]<=(unsigned long)17280 &&
  126. lvalue_list[1+offset]> (unsigned long)0 &&
  127. lvalue_list[1+offset]<=(unsigned long)100 &&
  128. lvalue_list[2+offset]> (unsigned long)0 &&
  129. lvalue_list[2+offset]<=(unsigned long)100) {
  130. /* Send request and retrieve data */
  131. asprintf(&send_buffer,"%s&2&%lu",req_password,lvalue_list[0+offset]);
  132. fetch_data (server_address, server_port, send_buffer);
  133. utilization=strtoul(recv_buffer,NULL,10);
  134. /* Check if any of the request is in a warning or critical state */
  135. if(utilization >= lvalue_list[2+offset])
  136. return_code=STATE_CRITICAL;
  137. else if(utilization >= lvalue_list[1+offset] && return_code<STATE_WARNING)
  138. return_code=STATE_WARNING;
  139. asprintf(&output_message,_(" %lu%% (%lu min average)"), utilization, lvalue_list[0+offset]);
  140. asprintf(&temp_string,"%s%s",temp_string,output_message);
  141. asprintf(&perfdata,_(" '%lu min avg Load'=%lu%%;%lu;%lu;0;100"), lvalue_list[0+offset], utilization,
  142. lvalue_list[1+offset], lvalue_list[2+offset]);
  143. asprintf(&temp_string_perf,"%s%s",temp_string_perf,perfdata);
  144. offset+=3; /* move across the array */
  145. }
  146. if (strlen(temp_string)>10) { /* we had at least one loop */
  147. output_message = strdup (temp_string);
  148. perfdata = temp_string_perf;
  149. } else
  150. output_message = strdup (_("not enough values for -l parameters"));
  151. }
  152. break;
  153. case CHECK_UPTIME:
  154. asprintf(&send_buffer, "%s&3", req_password);
  155. fetch_data (server_address, server_port, send_buffer);
  156. uptime=strtoul(recv_buffer,NULL,10);
  157. updays = uptime / 86400;
  158. uphours = (uptime % 86400) / 3600;
  159. upminutes = ((uptime % 86400) % 3600) / 60;
  160. asprintf(&output_message,_("System Uptime : %u day(s) %u hour(s) %u minute(s)"),updays,uphours, upminutes);
  161. return_code=STATE_OK;
  162. break;
  163. case CHECK_USEDDISKSPACE:
  164. if (value_list==NULL)
  165. output_message = strdup (_("missing -l parameters"));
  166. else if (strlen(value_list)!=1)
  167. output_message = strdup (_("wrong -l argument"));
  168. else {
  169. asprintf(&send_buffer,"%s&4&%s", req_password, value_list);
  170. fetch_data (server_address, server_port, send_buffer);
  171. free_disk_space=atof(strtok(recv_buffer,"&"));
  172. total_disk_space=atof(strtok(NULL,"&"));
  173. percent_used_space = ((total_disk_space - free_disk_space) / total_disk_space) * 100;
  174. warning_used_space = ((float)warning_value / 100) * total_disk_space;
  175. critical_used_space = ((float)critical_value / 100) * total_disk_space;
  176. if (free_disk_space>=0) {
  177. asprintf(&temp_string,_("%s:\\ - total: %.2f Gb - used: %.2f Gb (%.0f%%) - free %.2f Gb (%.0f%%)"),
  178. value_list, total_disk_space / 1073741824, (total_disk_space - free_disk_space) / 1073741824,
  179. percent_used_space, free_disk_space / 1073741824, (free_disk_space / total_disk_space)*100);
  180. asprintf(&temp_string_perf,_("'%s:\\ Used Space'=%.2fGb;%.2f;%.2f;0.00;%.2f"), value_list,
  181. (total_disk_space - free_disk_space) / 1073741824, warning_used_space / 1073741824,
  182. critical_used_space / 1073741824, total_disk_space / 1073741824);
  183. if(check_critical_value==TRUE && percent_used_space >= critical_value)
  184. return_code=STATE_CRITICAL;
  185. else if (check_warning_value==TRUE && percent_used_space >= warning_value)
  186. return_code=STATE_WARNING;
  187. else
  188. return_code=STATE_OK;
  189. output_message = strdup (temp_string);
  190. perfdata = temp_string_perf;
  191. } else {
  192. output_message = strdup (_("Free disk space : Invalid drive "));
  193. return_code=STATE_UNKNOWN;
  194. }
  195. }
  196. break;
  197. case CHECK_SERVICESTATE:
  198. case CHECK_PROCSTATE:
  199. if (value_list==NULL)
  200. output_message = strdup (_("No service/process specified"));
  201. else {
  202. preparelist(value_list); /* replace , between services with & to send the request */
  203. asprintf(&send_buffer,"%s&%u&%s&%s", req_password,(vars_to_check==CHECK_SERVICESTATE)?5:6,
  204. (show_all==TRUE)?_("ShowAll"):_("ShowFail"),value_list);
  205. fetch_data (server_address, server_port, send_buffer);
  206. return_code=atoi(strtok(recv_buffer,"&"));
  207. temp_string=strtok(NULL,"&");
  208. output_message = strdup (temp_string);
  209. }
  210. break;
  211. case CHECK_MEMUSE:
  212. asprintf(&send_buffer,"%s&7", req_password);
  213. fetch_data (server_address, server_port, send_buffer);
  214. mem_commitLimit=atof(strtok(recv_buffer,"&"));
  215. mem_commitByte=atof(strtok(NULL,"&"));
  216. percent_used_space = (mem_commitByte / mem_commitLimit) * 100;
  217. warning_used_space = ((float)warning_value / 100) * mem_commitLimit;
  218. critical_used_space = ((float)critical_value / 100) * mem_commitLimit;
  219. // Changed divisor in following line from 1048567 to 3044515 to accurately reflect memory size
  220. asprintf(&output_message,_("Memory usage: total:%.2f Mb - used: %.2f Mb (%.0f%%) - free: %.2f Mb (%.0f%%)"),
  221. mem_commitLimit / 3044515, mem_commitByte / 3044515, percent_used_space,
  222. (mem_commitLimit - mem_commitByte) / 3044515, (mem_commitLimit - mem_commitByte) / mem_commitLimit * 100);
  223. asprintf(&perfdata,_("'Memory usage'=%.2fMb;%.2f;%.2f;0.00;%.2f"), mem_commitByte / 3044515,
  224. warning_used_space / 3044515, critical_used_space / 3044515, mem_commitLimit / 3044515);
  225. return_code=STATE_OK;
  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. break;
  231. case CHECK_COUNTER:
  232. if (value_list==NULL)
  233. output_message = strdup (_("No counter specified"));
  234. else {
  235. preparelist(value_list); /* replace , between services with & to send the request */
  236. asprintf(&send_buffer,"%s&8&%s", req_password,value_list);
  237. fetch_data (server_address, server_port, send_buffer);
  238. strtok(value_list,"&"); /* burn the first parameters */
  239. description = strtok(NULL,"&");
  240. counter_value = atof(recv_buffer);
  241. if (description == NULL)
  242. asprintf(&output_message, "%.f", counter_value);
  243. else
  244. asprintf(&output_message,"%s = %.f", description, counter_value);
  245. asprintf(&perfdata,"'%s'=%.f", description, counter_value);
  246. if (critical_value > warning_value) { /* Normal thresholds */
  247. if(check_critical_value==TRUE && counter_value >= critical_value)
  248. return_code=STATE_CRITICAL;
  249. else if (check_warning_value==TRUE && counter_value >= warning_value)
  250. return_code=STATE_WARNING;
  251. else
  252. return_code=STATE_OK;
  253. }
  254. else { /* inverse thresholds */
  255. return_code=STATE_OK;
  256. if(check_critical_value==TRUE && counter_value <= critical_value)
  257. return_code=STATE_CRITICAL;
  258. else if (check_warning_value==TRUE && counter_value <= warning_value)
  259. return_code=STATE_WARNING;
  260. }
  261. }
  262. break;
  263. case CHECK_FILEAGE:
  264. if (value_list==NULL)
  265. output_message = strdup (_("No counter specified"));
  266. else {
  267. preparelist(value_list); /* replace , between services with & to send the request */
  268. asprintf(&send_buffer,"%s&9&%s", req_password,value_list);
  269. fetch_data (server_address, server_port, send_buffer);
  270. age_in_minutes = atoi(strtok(recv_buffer,"&"));
  271. description = strtok(NULL,"&");
  272. output_message = strdup (description);
  273. if (critical_value > warning_value) { /* Normal thresholds */
  274. if(check_critical_value==TRUE && age_in_minutes >= critical_value)
  275. return_code=STATE_CRITICAL;
  276. else if (check_warning_value==TRUE && age_in_minutes >= warning_value)
  277. return_code=STATE_WARNING;
  278. else
  279. return_code=STATE_OK;
  280. }
  281. else { /* inverse thresholds */
  282. if(check_critical_value==TRUE && age_in_minutes <= critical_value)
  283. return_code=STATE_CRITICAL;
  284. else if (check_warning_value==TRUE && age_in_minutes <= warning_value)
  285. return_code=STATE_WARNING;
  286. else
  287. return_code=STATE_OK;
  288. }
  289. }
  290. break;
  291. case CHECK_NONE:
  292. default:
  293. usage (_("Please specify a variable to check"));
  294. break;
  295. }
  296. /* reset timeout */
  297. alarm(0);
  298. if (perfdata==NULL)
  299. printf("%s\n",output_message);
  300. else
  301. printf("%s | %s\n",output_message,perfdata);
  302. return return_code;
  303. }
  304. /* process command-line arguments */
  305. int process_arguments(int argc, char **argv){
  306. int c;
  307. int option = 0;
  308. static struct option longopts[] =
  309. {
  310. {"port", required_argument,0,'p'},
  311. {"timeout", required_argument,0,'t'},
  312. {"critical", required_argument,0,'c'},
  313. {"warning", required_argument,0,'w'},
  314. {"variable", required_argument,0,'v'},
  315. {"hostname", required_argument,0,'H'},
  316. {"version", no_argument, 0,'V'},
  317. {"help", no_argument, 0,'h'},
  318. {0,0,0,0}
  319. };
  320. /* no options were supplied */
  321. if(argc<2) return ERROR;
  322. /* backwards compatibility */
  323. if (! is_option(argv[1])) {
  324. server_address = strdup(argv[1]);
  325. argv[1]=argv[0];
  326. argv=&argv[1];
  327. argc--;
  328. }
  329. for (c=1;c<argc;c++) {
  330. if(strcmp("-to",argv[c])==0)
  331. strcpy(argv[c],"-t");
  332. else if (strcmp("-wv",argv[c])==0)
  333. strcpy(argv[c],"-w");
  334. else if (strcmp("-cv",argv[c])==0)
  335. strcpy(argv[c],"-c");
  336. }
  337. while (1){
  338. c = getopt_long(argc,argv,"+hVH:t:c:w:p:v:l:s:d:",longopts,&option);
  339. if (c==-1||c==EOF||c==1)
  340. break;
  341. switch (c)
  342. {
  343. case '?': /* print short usage statement if args not parsable */
  344. printf("%s: Unknown argument: %s\n\n",progname,optarg);
  345. print_usage();
  346. exit(STATE_UNKNOWN);
  347. case 'h': /* help */
  348. print_help();
  349. exit(STATE_OK);
  350. case 'V': /* version */
  351. print_revision(progname,"$Revision$");
  352. exit(STATE_OK);
  353. case 'H': /* hostname */
  354. if (server_address) free(server_address);
  355. server_address = optarg;
  356. break;
  357. case 's': /* password */
  358. req_password = optarg;
  359. break;
  360. case 'p': /* port */
  361. if (is_intnonneg(optarg))
  362. server_port=atoi(optarg);
  363. else
  364. die(STATE_UNKNOWN,_("Server port an integer (seconds)\nType '%s -h' for additional help\n"),progname);
  365. break;
  366. case 'v':
  367. if(strlen(optarg)<4)
  368. return ERROR;
  369. if(!strcmp(optarg,"CLIENTVERSION"))
  370. vars_to_check=CHECK_CLIENTVERSION;
  371. else if(!strcmp(optarg,"CPULOAD"))
  372. vars_to_check=CHECK_CPULOAD;
  373. else if(!strcmp(optarg,"UPTIME"))
  374. vars_to_check=CHECK_UPTIME;
  375. else if(!strcmp(optarg,"USEDDISKSPACE"))
  376. vars_to_check=CHECK_USEDDISKSPACE;
  377. else if(!strcmp(optarg,"SERVICESTATE"))
  378. vars_to_check=CHECK_SERVICESTATE;
  379. else if(!strcmp(optarg,"PROCSTATE"))
  380. vars_to_check=CHECK_PROCSTATE;
  381. else if(!strcmp(optarg,"MEMUSE"))
  382. vars_to_check=CHECK_MEMUSE;
  383. else if(!strcmp(optarg,"COUNTER"))
  384. vars_to_check=CHECK_COUNTER;
  385. else if(!strcmp(optarg,"FILEAGE"))
  386. vars_to_check=CHECK_FILEAGE;
  387. else
  388. return ERROR;
  389. break;
  390. case 'l': /* value list */
  391. value_list = optarg;
  392. break;
  393. case 'w': /* warning threshold */
  394. warning_value=strtoul(optarg,NULL,10);
  395. check_warning_value=TRUE;
  396. break;
  397. case 'c': /* critical threshold */
  398. critical_value=strtoul(optarg,NULL,10);
  399. check_critical_value=TRUE;
  400. break;
  401. case 'd': /* Display select for services */
  402. if (!strcmp(optarg,"SHOWALL"))
  403. show_all = TRUE;
  404. break;
  405. case 't': /* timeout */
  406. socket_timeout=atoi(optarg);
  407. if(socket_timeout<=0)
  408. return ERROR;
  409. }
  410. }
  411. if (vars_to_check==CHECK_NONE)
  412. return ERROR;
  413. if (req_password == NULL)
  414. req_password = strdup (_("None"));
  415. return OK;
  416. }
  417. void fetch_data (const char *address, int port, const char *sendb) {
  418. int result;
  419. result=process_tcp_request(address, port, sendb, recv_buffer,sizeof(recv_buffer));
  420. if(result!=STATE_OK)
  421. die (result, "could not fetch information from server\n");
  422. if (!strncmp(recv_buffer,"ERROR",5))
  423. die (STATE_UNKNOWN, "NSClient - %s\n",recv_buffer);
  424. }
  425. int strtoularray(unsigned long *array, char *string, const char *delim) {
  426. /* split a <delim> delimited string into a long array */
  427. int idx=0;
  428. char *t1;
  429. for (idx=0;idx<MAX_VALUE_LIST;idx++)
  430. array[idx]=0;
  431. idx=0;
  432. for(t1 = strtok(string,delim);t1 != NULL; t1 = strtok(NULL, delim)) {
  433. if (is_numeric(t1) && idx<MAX_VALUE_LIST) {
  434. array[idx]=strtoul(t1,NULL,10);
  435. idx++;
  436. } else
  437. return FALSE;
  438. }
  439. return TRUE;
  440. }
  441. void preparelist(char *string) {
  442. /* Replace all , with & which is the delimiter for the request */
  443. int i;
  444. for (i = 0; (size_t)i < strlen(string); i++)
  445. if (string[i] == ',') {
  446. string[i]='&';
  447. }
  448. }
  449. void print_help(void)
  450. {
  451. print_revision(progname,"$Revision$");
  452. printf (_("\
  453. Copyright (c) 2000 Yves Rubin (rubiyz@yahoo.com)\n\n\
  454. This plugin collects data from the NSClient service running on a\n\
  455. Windows NT/2000/XP server.\n\n"));
  456. print_usage();
  457. printf (_("\nOptions:\n\
  458. -H, --hostname=HOST\n\
  459. Name of the host to check\n\
  460. -p, --port=INTEGER\n\
  461. Optional port number (default: %d)\n\
  462. -s <password>\n\
  463. Password needed for the request\n\
  464. -w, --warning=INTEGER\n\
  465. Threshold which will result in a warning status\n\
  466. -c, --critical=INTEGER\n\
  467. Threshold which will result in a critical status\n\
  468. -t, --timeout=INTEGER\n\
  469. Seconds before connection attempt times out (default: %d)\n\
  470. -h, --help\n\
  471. Print this help screen\n\
  472. -V, --version\n\
  473. Print version information\n"),
  474. PORT, DEFAULT_SOCKET_TIMEOUT);
  475. printf (_("\
  476. -v, --variable=STRING\n\
  477. Variable to check. Valid variables are:\n"));
  478. printf (_("\
  479. CLIENTVERSION = Get the NSClient version\n\
  480. If -l <version> is specified, will return warning if versions differ.\n"));
  481. printf (_("\
  482. CPULOAD = Average CPU load on last x minutes.\n\
  483. Request a -l parameter with the following syntax:\n\
  484. -l <minutes range>,<warning threshold>,<critical threshold>.\n\
  485. <minute range> should be less than 24*60.\n\
  486. Thresholds are percentage and up to 10 requests can be done in one shot.\n\
  487. ie: -l 60,90,95,120,90,95\n"));
  488. printf (_("\
  489. UPTIME = Get the uptime of the machine.\n\
  490. No specific parameters. No warning or critical threshold\n"));
  491. printf (_("\
  492. USEDDISKSPACE = Size and percentage of disk use.\n\
  493. Request a -l parameter containing the drive letter only.\n\
  494. Warning and critical thresholds can be specified with -w and -c.\n"));
  495. printf (_("\
  496. MEMUSE = Memory use.\n\
  497. Warning and critical thresholds can be specified with -w and -c.\n"));
  498. printf (_("\
  499. SERVICESTATE = Check the state of one or several services.\n\
  500. Request a -l parameters with the following syntax:\n\
  501. -l <service1>,<service2>,<service3>,...\n\
  502. You can specify -d SHOWALL in case you want to see working services\n\
  503. in the returned string.\n"));
  504. printf (_("\
  505. PROCSTATE = Check if one or several process are running.\n\
  506. Same syntax as SERVICESTATE.\n"));
  507. printf (_("\
  508. COUNTER = Check any performance counter of Windows NT/2000.\n\
  509. Request a -l parameters with the following syntax:\n\
  510. -l \"\\\\<performance object>\\\\counter\",\"<description>\n\
  511. The <description> parameter is optional and \n\
  512. is given to a printf output command which require a float parameters.\n\
  513. Some examples:\n\
  514. \"Paging file usage is %%.2f %%%%\"\n\
  515. \"%%.f %%%% paging file used.\"\n"));
  516. printf (_("Notes:\n\
  517. - The NSClient service should be running on the server to get any information\n\
  518. (http://nsclient.ready2run.nl).\n\
  519. - Critical thresholds should be lower than warning thresholds\n"));
  520. }
  521. void print_usage(void)
  522. {
  523. printf(_("\
  524. Usage: %s -H host -v variable [-p port] [-w warning] [-c critical]\n\
  525. [-l params] [-d SHOWALL] [-t timeout]\n"), progname);
  526. printf (_(UT_HLP_VRS), progname, progname);
  527. }