4
0

check_swap.c 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593
  1. /*****************************************************************************
  2. *
  3. * Nagios check_swap plugin
  4. *
  5. * License: GPL
  6. * Copyright (c) 2000 Karl DeBisschop (kdebisschop@users.sourceforge.net)
  7. * Copyright (c) 2000-2023 Nagios Plugins Development Team
  8. *
  9. * Description:
  10. *
  11. * This file contains the check_swap plugin
  12. *
  13. *
  14. * This program is free software: you can redistribute it and/or modify
  15. * it under the terms of the GNU General Public License as published by
  16. * the Free Software Foundation, either version 3 of the License, or
  17. * (at your option) any later version.
  18. *
  19. * This program is distributed in the hope that it will be useful,
  20. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  21. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  22. * GNU General Public License for more details.
  23. *
  24. * You should have received a copy of the GNU General Public License
  25. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  26. *
  27. *
  28. *****************************************************************************/
  29. const char *progname = "check_swap";
  30. const char *copyright = "2000-2023";
  31. const char *email = "devel@nagios-plugins.org";
  32. #include "common.h"
  33. #include "popen.h"
  34. #include "utils.h"
  35. #ifdef HAVE_DECL_SWAPCTL
  36. # ifdef HAVE_SYS_PARAM_H
  37. # include <sys/param.h>
  38. # endif
  39. # ifdef HAVE_SYS_SWAP_H
  40. # include <sys/swap.h>
  41. # endif
  42. # ifdef HAVE_SYS_STAT_H
  43. # include <sys/stat.h>
  44. # endif
  45. #endif
  46. #ifndef SWAP_CONVERSION
  47. # define SWAP_CONVERSION 1
  48. #endif
  49. int check_swap (int usp, double free_swap_mb);
  50. int process_arguments (int argc, char **argv);
  51. int validate_arguments (void);
  52. void print_usage (void);
  53. void print_help (void);
  54. int have_warn = 0;
  55. int have_crit = 0;
  56. int warn_percent = 0;
  57. int crit_percent = 0;
  58. double warn_size_bytes = 0;
  59. double crit_size_bytes= 0;
  60. int verbose;
  61. int allswaps;
  62. int no_swap_state = STATE_CRITICAL;
  63. int
  64. main (int argc, char **argv)
  65. {
  66. int percent_used, percent;
  67. double total_swap_mb = 0, used_swap_mb = 0, free_swap_mb = 0;
  68. double dsktotal_mb = 0, dskused_mb = 0, dskfree_mb = 0, tmp_mb = 0;
  69. int result = STATE_UNKNOWN;
  70. char input_buffer[MAX_INPUT_BUFFER];
  71. #ifdef HAVE_PROC_MEMINFO
  72. FILE *fp;
  73. #else
  74. int conv_factor = SWAP_CONVERSION;
  75. # ifdef HAVE_SWAP
  76. char *temp_buffer;
  77. char *swap_command;
  78. char *swap_format;
  79. # else
  80. # ifdef HAVE_DECL_SWAPCTL
  81. int i=0, nswaps=0, swapctl_res=0;
  82. # ifdef CHECK_SWAP_SWAPCTL_SVR4
  83. swaptbl_t *tbl=NULL;
  84. swapent_t *ent=NULL;
  85. # else
  86. # ifdef CHECK_SWAP_SWAPCTL_BSD
  87. struct swapent *ent;
  88. # endif /* CHECK_SWAP_SWAPCTL_BSD */
  89. # endif /* CHECK_SWAP_SWAPCTL_SVR4 */
  90. # endif /* HAVE_DECL_SWAPCTL */
  91. # endif
  92. #endif
  93. char str[32];
  94. char *status;
  95. setlocale (LC_ALL, "");
  96. bindtextdomain (PACKAGE, LOCALEDIR);
  97. textdomain (PACKAGE);
  98. status = strdup ("");
  99. /* Parse extra opts if any */
  100. argv=np_extra_opts (&argc, argv, progname);
  101. if (process_arguments (argc, argv) == ERROR)
  102. usage4 (_("Could not parse arguments"));
  103. #ifdef HAVE_PROC_MEMINFO
  104. if (verbose >= 3) {
  105. printf("Reading PROC_MEMINFO at %s\n", PROC_MEMINFO);
  106. }
  107. fp = fopen (PROC_MEMINFO, "r");
  108. while (fgets (input_buffer, MAX_INPUT_BUFFER - 1, fp)) {
  109. if (sscanf (input_buffer, "%*[S]%*[w]%*[a]%*[p]%*[:] %lf %lf %lf", &dsktotal_mb, &dskused_mb, &dskfree_mb) == 3) {
  110. dsktotal_mb = dsktotal_mb / 1048576; /* Apply conversion */
  111. dskused_mb = dskused_mb / 1048576;
  112. dskfree_mb = dskfree_mb / 1048576;
  113. total_swap_mb += dsktotal_mb;
  114. used_swap_mb += dskused_mb;
  115. free_swap_mb += dskfree_mb;
  116. if (allswaps) {
  117. if (dsktotal_mb == 0)
  118. percent=0.0;
  119. else
  120. percent = 100 * (((double) dskused_mb) / ((double) dsktotal_mb));
  121. result = max_state (result, check_swap (percent, dskfree_mb));
  122. if (verbose)
  123. xasprintf (&status, "%s [%.0f (%d%%)]", status, dskfree_mb, 100 - percent);
  124. }
  125. }
  126. else if (sscanf (input_buffer, "%*[S]%*[w]%*[a]%*[p]%[TotalFre]%*[:] %lf %*[k]%*[B]", str, &tmp_mb)) {
  127. if (verbose >= 3) {
  128. printf("Got %s with %lf\n", str, tmp_mb);
  129. }
  130. /* I think this part is always in Kb, so convert to mb */
  131. if (strcmp ("Total", str) == 0) {
  132. dsktotal_mb = tmp_mb / 1024;
  133. }
  134. else if (strcmp ("Free", str) == 0) {
  135. dskfree_mb = tmp_mb / 1024;
  136. }
  137. }
  138. }
  139. fclose(fp);
  140. dskused_mb = dsktotal_mb - dskfree_mb;
  141. total_swap_mb = dsktotal_mb;
  142. used_swap_mb = dskused_mb;
  143. free_swap_mb = dskfree_mb;
  144. #else
  145. # ifdef HAVE_SWAP
  146. xasprintf(&swap_command, "%s", SWAP_COMMAND);
  147. xasprintf(&swap_format, "%s", SWAP_FORMAT);
  148. /* These override the command used if a summary (and thus ! allswaps) is required */
  149. /* The summary flag returns more accurate information about swap usage on these OSes */
  150. # ifdef _AIX
  151. if (!allswaps) {
  152. xasprintf(&swap_command, "%s", "/usr/sbin/lsps -s");
  153. xasprintf(&swap_format, "%s", "%lf%*s %lf");
  154. conv_factor = 1;
  155. }
  156. # endif
  157. if (verbose >= 2)
  158. printf (_("Command: %s\n"), swap_command);
  159. if (verbose >= 3)
  160. printf (_("Format: %s\n"), swap_format);
  161. child_process = spopen (swap_command);
  162. if (child_process == NULL) {
  163. printf (_("Could not open pipe: %s\n"), swap_command);
  164. return STATE_UNKNOWN;
  165. }
  166. child_stderr = fdopen (child_stderr_array[fileno (child_process)], "r");
  167. if (child_stderr == NULL)
  168. printf (_("Could not open stderr for %s\n"), swap_command);
  169. sprintf (str, "%s", "");
  170. /* read 1st line */
  171. fgets (input_buffer, MAX_INPUT_BUFFER - 1, child_process);
  172. if (strcmp (swap_format, "") == 0) {
  173. temp_buffer = strtok (input_buffer, " \n");
  174. while (temp_buffer) {
  175. if (strstr (temp_buffer, "blocks"))
  176. sprintf (str, "%s %s", str, "%lf");
  177. else if (strstr (temp_buffer, "dskfree"))
  178. sprintf (str, "%s %s", str, "%lf");
  179. else
  180. sprintf (str, "%s %s", str, "%*s");
  181. temp_buffer = strtok (NULL, " \n");
  182. }
  183. }
  184. /* If different swap command is used for summary switch, need to read format differently */
  185. # ifdef _AIX
  186. if (!allswaps) {
  187. fgets(input_buffer, MAX_INPUT_BUFFER - 1, child_process); /* Ignore first line */
  188. sscanf (input_buffer, swap_format, &total_swap_mb, &used_swap_mb);
  189. free_swap_mb = total_swap_mb * (100 - used_swap_mb) /100;
  190. used_swap_mb = total_swap_mb - free_swap_mb;
  191. if (verbose >= 3)
  192. printf (_("total=%.0f, used=%.0f, free=%.0f\n"), total_swap_mb, used_swap_mb, free_swap_mb);
  193. } else {
  194. # endif
  195. while (fgets (input_buffer, MAX_INPUT_BUFFER - 1, child_process)) {
  196. sscanf (input_buffer, swap_format, &dsktotal_mb, &dskfree_mb);
  197. dsktotal_mb = dsktotal_mb / conv_factor;
  198. /* AIX lists percent used, so this converts to dskfree in MBs */
  199. # ifdef _AIX
  200. dskfree_mb = dsktotal_mb * (100 - dskfree_mb) / 100;
  201. # else
  202. dskfree_mb = dskfree_mb / conv_factor;
  203. # endif
  204. if (verbose >= 3)
  205. printf (_("total=%.0f, free=%.0f\n"), dsktotal_mb, dskfree_mb);
  206. dskused_mb = dsktotal_mb - dskfree_mb;
  207. total_swap_mb += dsktotal_mb;
  208. used_swap_mb += dskused_mb;
  209. free_swap_mb += dskfree_mb;
  210. if (allswaps) {
  211. percent = 100 * (((double) dskused_mb) / ((double) dsktotal_mb));
  212. result = max_state (result, check_swap (percent, dskfree_mb));
  213. if (verbose)
  214. xasprintf (&status, "%s [%.0f (%d%%)]", status, dskfree_mb, 100 - percent);
  215. }
  216. }
  217. # ifdef _AIX
  218. }
  219. # endif
  220. /* If we get anything on STDERR, at least set warning */
  221. while (fgets (input_buffer, MAX_INPUT_BUFFER - 1, child_stderr))
  222. result = max_state (result, STATE_WARNING);
  223. /* close stderr */
  224. (void) fclose (child_stderr);
  225. /* close the pipe */
  226. if (spclose (child_process))
  227. result = max_state (result, STATE_WARNING);
  228. # else
  229. # ifdef CHECK_SWAP_SWAPCTL_SVR4
  230. /* get the number of active swap devices */
  231. if((nswaps=swapctl(SC_GETNSWP, NULL))== -1)
  232. die(STATE_UNKNOWN, _("Error getting swap devices\n") );
  233. if(nswaps == 0)
  234. die(STATE_OK, _("SWAP OK: No swap devices defined\n"));
  235. if(verbose >= 3)
  236. printf("Found %d swap device(s)\n", nswaps);
  237. /* initialize swap table + entries */
  238. tbl=(swaptbl_t*)malloc(sizeof(swaptbl_t)+(sizeof(swapent_t)*nswaps));
  239. if(tbl==NULL)
  240. die(STATE_UNKNOWN, _("malloc() failed!\n"));
  241. memset(tbl, 0, sizeof(swaptbl_t)+(sizeof(swapent_t)*nswaps));
  242. tbl->swt_n=nswaps;
  243. for(i=0;i<nswaps;i++){
  244. if((tbl->swt_ent[i].ste_path=(char*)malloc(sizeof(char)*MAXPATHLEN)) == NULL)
  245. die(STATE_UNKNOWN, _("malloc() failed!\n"));
  246. }
  247. /* and now, tally 'em up */
  248. swapctl_res=swapctl(SC_LIST, tbl);
  249. if(swapctl_res < 0){
  250. perror(_("swapctl failed: "));
  251. die(STATE_UNKNOWN, _("Error in swapctl call\n"));
  252. }
  253. for(i=0;i<nswaps;i++){
  254. dsktotal_mb = (double) tbl->swt_ent[i].ste_pages / SWAP_CONVERSION;
  255. dskfree_mb = (double) tbl->swt_ent[i].ste_free / SWAP_CONVERSION;
  256. dskused_mb = ( dsktotal_mb - dskfree_mb );
  257. if (verbose >= 3)
  258. printf ("dsktotal_mb=%.0f dskfree_mb=%.0f dskused_mb=%.0f\n", dsktotal_mb, dskfree_mb, dskused_mb);
  259. if(allswaps && dsktotal_mb > 0){
  260. percent = 100 * (((double) dskused_mb) / ((double) dsktotal_mb));
  261. result = max_state (result, check_swap (percent, dskfree_mb));
  262. if (verbose) {
  263. xasprintf (&status, "%s [%.0f (%d%%)]", status, dskfree_mb, 100 - percent);
  264. }
  265. }
  266. total_swap_mb += dsktotal_mb;
  267. free_swap_mb += dskfree_mb;
  268. used_swap_mb += dskused_mb;
  269. }
  270. /* and clean up after ourselves */
  271. for(i=0;i<nswaps;i++){
  272. free(tbl->swt_ent[i].ste_path);
  273. }
  274. free(tbl);
  275. # else
  276. # ifdef CHECK_SWAP_SWAPCTL_BSD
  277. /* get the number of active swap devices */
  278. nswaps=swapctl(SWAP_NSWAP, NULL, 0);
  279. /* initialize swap table + entries */
  280. ent=(struct swapent*)malloc(sizeof(struct swapent)*nswaps);
  281. /* and now, tally 'em up */
  282. swapctl_res=swapctl(SWAP_STATS, ent, nswaps);
  283. if(swapctl_res < 0){
  284. perror(_("swapctl failed: "));
  285. die(STATE_UNKNOWN, _("Error in swapctl call\n"));
  286. }
  287. for(i=0;i<nswaps;i++){
  288. dsktotal_mb = (double) ent[i].se_nblks / conv_factor;
  289. dskused_mb = (double) ent[i].se_inuse / conv_factor;
  290. dskfree_mb = ( dsktotal_mb - dskused_mb );
  291. if(allswaps && dsktotal_mb > 0){
  292. percent = 100 * (((double) dskused_mb) / ((double) dsktotal_mb));
  293. result = max_state (result, check_swap (percent, dskfree_mb));
  294. if (verbose) {
  295. xasprintf (&status, "%s [%.0f (%d%%)]", status, dskfree_mb, 100 - percent);
  296. }
  297. }
  298. total_swap_mb += dsktotal_mb;
  299. free_swap_mb += dskfree_mb;
  300. used_swap_mb += dskused_mb;
  301. }
  302. /* and clean up after ourselves */
  303. free(ent);
  304. # endif /* CHECK_SWAP_SWAPCTL_BSD */
  305. # endif /* CHECK_SWAP_SWAPCTL_SVR4 */
  306. # endif /* HAVE_SWAP */
  307. #endif /* HAVE_PROC_MEMINFO */
  308. /* if total_swap_mb == 0, swap is most likely missing or disabled and should go critical */
  309. if(total_swap_mb == 0) {
  310. percent_used = 100;
  311. status = "- Swap is either disabled, not present, or of zero size. ";
  312. } else if(total_swap_mb > 0) {
  313. percent_used = 100 * ((double) used_swap_mb) / ((double) total_swap_mb);
  314. } else {
  315. percent_used = 100;
  316. status = "- Swap is either disabled, not present, or of zero size. ";
  317. }
  318. result = max_state (result, check_swap (percent_used, free_swap_mb));
  319. printf (_("SWAP %s - %d%% free (%d MB out of %d MB) %s|"),
  320. state_text (result),
  321. (100 - percent_used), (int) free_swap_mb, (int) total_swap_mb, status);
  322. puts (perfdata ("swap", (long) free_swap_mb, "MB",
  323. TRUE, (long) max (warn_size_bytes/(1024 * 1024), warn_percent/100.0*total_swap_mb),
  324. TRUE, (long) max (crit_size_bytes/(1024 * 1024), crit_percent/100.0*total_swap_mb),
  325. TRUE, 0,
  326. TRUE, (long) total_swap_mb));
  327. return result;
  328. }
  329. int
  330. check_swap (int usp, double free_swap_mb)
  331. {
  332. int result = STATE_UNKNOWN;
  333. double free_swap = free_swap_mb * (1024 * 1024); /* Convert back to bytes as warn and crit specified in bytes */
  334. if (have_warn > 0 && have_crit > 0) {
  335. if (!free_swap_mb) return no_swap_state;
  336. if (usp >= 0 && crit_percent != 0 && usp >= (100.0 - crit_percent))
  337. result = STATE_CRITICAL;
  338. else if (crit_size_bytes > 0 && free_swap <= crit_size_bytes)
  339. result = STATE_CRITICAL;
  340. else if (usp >= 0 && warn_percent != 0 && usp >= (100.0 - warn_percent))
  341. result = STATE_WARNING;
  342. else if (warn_size_bytes > 0 && free_swap <= warn_size_bytes)
  343. result = STATE_WARNING;
  344. else if (usp >= 0.0)
  345. result = STATE_OK;
  346. } else {
  347. result = STATE_OK;
  348. }
  349. return result;
  350. }
  351. /* process command-line arguments */
  352. int
  353. process_arguments (int argc, char **argv)
  354. {
  355. int c = 0; /* option character */
  356. int option = 0;
  357. static struct option longopts[] = {
  358. {"warning", required_argument, 0, 'w'},
  359. {"critical", required_argument, 0, 'c'},
  360. {"allswaps", no_argument, 0, 'a'},
  361. {"no-swap", required_argument, 0, 'n'},
  362. {"verbose", no_argument, 0, 'v'},
  363. {"version", no_argument, 0, 'V'},
  364. {"help", no_argument, 0, 'h'},
  365. {0, 0, 0, 0}
  366. };
  367. while (1) {
  368. c = getopt_long (argc, argv, "+?Vvhac:w:n:", longopts, &option);
  369. if (c == -1 || c == EOF)
  370. break;
  371. switch (c) {
  372. case 'w': /* warning size threshold */
  373. if (is_intnonneg (optarg)) {
  374. warn_size_bytes = (double) atoi (optarg);
  375. have_warn = TRUE;
  376. break;
  377. }
  378. else if (strstr (optarg, ",") &&
  379. strstr (optarg, "%") &&
  380. sscanf (optarg, "%lf,%d%%", &warn_size_bytes, &warn_percent) == 2) {
  381. warn_size_bytes = floorf(warn_size_bytes);
  382. have_warn = TRUE;
  383. break;
  384. }
  385. else if (strstr (optarg, "%") &&
  386. sscanf (optarg, "%d%%", &warn_percent) == 1) {
  387. have_warn = TRUE;
  388. break;
  389. }
  390. else {
  391. have_warn = FALSE;
  392. }
  393. case 'c': /* critical size threshold */
  394. if (is_intnonneg (optarg)) {
  395. crit_size_bytes = (double) atoi (optarg);
  396. have_crit = TRUE;
  397. break;
  398. }
  399. else if (strstr (optarg, ",") &&
  400. strstr (optarg, "%") &&
  401. sscanf (optarg, "%lf,%d%%", &crit_size_bytes, &crit_percent) == 2) {
  402. crit_size_bytes = floorf(crit_size_bytes);
  403. have_crit = TRUE;
  404. break;
  405. }
  406. else if (strstr (optarg, "%") &&
  407. sscanf (optarg, "%d%%", &crit_percent) == 1) {
  408. have_crit = TRUE;
  409. break;
  410. }
  411. else {
  412. have_crit = FALSE;
  413. }
  414. case 'a': /* all swap */
  415. allswaps = TRUE;
  416. break;
  417. case 'n': /* no-swap */
  418. if ((no_swap_state = translate_state(optarg)) == ERROR) {
  419. usage4 (_("no-swap result must be a valid state name (OK, WARNING, CRITICAL, UNKNOWN) or integer (0-3)."));
  420. }
  421. case 'v': /* verbose */
  422. verbose++;
  423. break;
  424. case 'V': /* version */
  425. print_revision (progname, NP_VERSION);
  426. exit (STATE_OK);
  427. case 'h': /* help */
  428. print_help ();
  429. exit (STATE_OK);
  430. case '?': /* error */
  431. usage5 ();
  432. }
  433. }
  434. c = optind;
  435. if (c == argc)
  436. return validate_arguments ();
  437. if (warn_percent == 0 && is_intnonneg (argv[c]))
  438. warn_percent = atoi (argv[c++]);
  439. if (c == argc)
  440. return validate_arguments ();
  441. if (crit_percent == 0 && is_intnonneg (argv[c]))
  442. crit_percent = atoi (argv[c++]);
  443. if (c == argc)
  444. return validate_arguments ();
  445. if (warn_size_bytes == 0 && is_intnonneg (argv[c]))
  446. warn_size_bytes = (double) atoi (argv[c++]);
  447. if (c == argc)
  448. return validate_arguments ();
  449. if (crit_size_bytes == 0 && is_intnonneg (argv[c]))
  450. crit_size_bytes = (double) atoi (argv[c++]);
  451. return validate_arguments ();
  452. }
  453. int
  454. validate_arguments (void)
  455. {
  456. if (have_warn > 0 && have_crit == 0) {
  457. usage4
  458. (_("Must define both warning and critical thresholds"));
  459. }
  460. else if (have_crit > 0 && have_warn == 0) {
  461. usage4
  462. (_("Must define both warning and critical thresholds"));
  463. }
  464. else if (warn_percent < 0 || crit_percent < 0 || warn_size_bytes < 0
  465. || crit_size_bytes < 0) {
  466. return ERROR;
  467. }
  468. else if (warn_percent < crit_percent) {
  469. usage4
  470. (_("Warning percentage should be more than critical percentage"));
  471. }
  472. else if (warn_size_bytes < crit_size_bytes) {
  473. usage4
  474. (_("Warning free space should be more than critical free space"));
  475. }
  476. return OK;
  477. }
  478. void
  479. print_help (void)
  480. {
  481. print_revision (progname, NP_VERSION);
  482. printf (_(COPYRIGHT), copyright, email);
  483. printf ("%s\n", _("Check swap space on local machine."));
  484. printf ("\n\n");
  485. print_usage ();
  486. printf (UT_HELP_VRSN);
  487. printf (UT_EXTRA_OPTS);
  488. printf (" %s\n", "-w, --warning=INTEGER");
  489. printf (" %s\n", _("Exit with WARNING status if less than INTEGER bytes of swap space are free"));
  490. printf (" %s\n", "-w, --warning=PERCENT%");
  491. printf (" %s\n", _("Exit with WARNING status if less than PERCENT of swap space is free"));
  492. printf (" %s\n", "-c, --critical=INTEGER");
  493. printf (" %s\n", _("Exit with CRITICAL status if less than INTEGER bytes of swap space are free"));
  494. printf (" %s\n", "-c, --critical=PERCENT%");
  495. printf (" %s\n", _("Exit with CRITICAL status if less than PERCENT of swap space is free"));
  496. printf (" %s\n", "-a, --allswaps");
  497. printf (" %s\n", _("Conduct comparisons for all swap partitions, one by one"));
  498. printf (" %s\n", "-n, --no-swap=<ok|warning|critical|unknown>");
  499. printf (" %s %s\n", _("Resulting state when there is no swap regardless of thresholds. Default:"), state_text(no_swap_state));
  500. printf (UT_VERBOSE);
  501. printf ("\n");
  502. printf ("%s\n", _("Notes:"));
  503. printf (" %s\n", _("Both INTEGER and PERCENT thresholds can be specified, they are all checked."));
  504. printf (" %s\n", _("Without thresholds, the plugin shows free swap space and performance data, but always returns OK."));
  505. printf (" %s\n", _("On AIX, if -a is specified, uses lsps -a, otherwise uses lsps -s."));
  506. printf (UT_SUPPORT);
  507. }
  508. void
  509. print_usage (void)
  510. {
  511. printf ("%s\n", _("Usage:"));
  512. printf (" %s [-av] [-w <percent_free>%% -c <percent_free>%%]\n",progname);
  513. printf (" [-w <bytes_free> -c <bytes_free>] [-n <state>]\n");
  514. }