check_nt.c 19 KB

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