f0a679dd5f13f9b2843363ccceffeab2ada7e764
1 /******************************************************************************
2 *
3 * Nagios check_disk plugin
4 *
5 * License: GPL
6 * Copyright (c) 1999-2006 nagios-plugins team
7 *
8 * Last Modified: $Date$
9 *
10 * Description:
11 *
12 * This file contains the check_disk plugin
13 *
14 * License Information:
15 *
16 * This program is free software; you can redistribute it and/or modify
17 * it under the terms of the GNU General Public License as published by
18 * the Free Software Foundation; either version 2 of the License, or
19 * (at your option) any later version.
20 *
21 * This program is distributed in the hope that it will be useful,
22 * but WITHOUT ANY WARRANTY; without even the implied warranty of
23 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
24 * GNU General Public License for more details.
25 *
26 * You should have received a copy of the GNU General Public License
27 * along with this program; if not, write to the Free Software
28 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
29 *
30 * $Id$
31 *
32 *****************************************************************************/
34 const char *progname = "check_disk";
35 const char *program_name = "check_disk"; /* Required for coreutils libs */
36 const char *revision = "$Revision$";
37 const char *copyright = "1999-2006";
38 const char *email = "nagiosplug-devel@lists.sourceforge.net";
41 #include "common.h"
42 #if HAVE_INTTYPES_H
43 # include <inttypes.h>
44 #endif
45 #include <assert.h>
46 #include "popen.h"
47 #include "utils.h"
48 #include <stdarg.h>
49 #include "fsusage.h"
50 #include "mountlist.h"
51 #if HAVE_LIMITS_H
52 # include <limits.h>
53 #endif
55 #include "utils_disk.h"
57 /* If nonzero, show inode information. */
58 static int inode_format;
60 /* If nonzero, show even filesystems with zero size or
61 uninteresting types. */
62 static int show_all_fs = 1;
64 /* If nonzero, show only local filesystems. */
65 static int show_local_fs = 0;
67 /* If positive, the units to use when printing sizes;
68 if negative, the human-readable base. */
69 /* static int output_block_size; */
71 /* If nonzero, invoke the `sync' system call before getting any usage data.
72 Using this option can make df very slow, especially with many or very
73 busy disks. Note that this may make a difference on some systems --
74 SunOs4.1.3, for one. It is *not* necessary on Linux. */
75 /* static int require_sync = 0; */
77 /* A filesystem type to display. */
78 struct parameter_list
79 {
80 char *name;
81 int found;
82 int found_len;
83 uintmax_t w_df;
84 uintmax_t c_df;
85 double w_dfp;
86 double c_dfp;
87 double w_idfp;
88 double c_idfp;
89 struct parameter_list *name_next;
90 };
92 /* Linked list of filesystem types to display.
93 If `fs_select_list' is NULL, list all types.
94 This table is generated dynamically from command-line options,
95 rather than hardcoding into the program what it thinks are the
96 valid filesystem types; let the user specify any filesystem type
97 they want to, and if there are any filesystems of that type, they
98 will be shown.
100 Some filesystem types:
101 4.2 4.3 ufs nfs swap ignore io vm efs dbg */
103 /* static struct parameter_list *fs_select_list; */
105 /* Linked list of filesystem types to omit.
106 If the list is empty, don't exclude any types. */
108 static struct name_list *fs_exclude_list;
110 static struct name_list *dp_exclude_list;
112 static struct parameter_list *path_select_list;
114 /* Linked list of mounted filesystems. */
115 static struct mount_entry *mount_list;
117 /* For long options that have no equivalent short option, use a
118 non-character as a pseudo short option, starting with CHAR_MAX + 1. */
119 enum
120 {
121 SYNC_OPTION = CHAR_MAX + 1,
122 NO_SYNC_OPTION,
123 BLOCK_SIZE_OPTION
124 };
126 #ifdef _AIX
127 #pragma alloca
128 #endif
130 /* Linked list of mounted filesystems. */
131 static struct mount_entry *mount_list;
133 int process_arguments (int, char **);
134 void print_path (const char *mypath);
135 int validate_arguments (uintmax_t, uintmax_t, double, double, double, double, char *);
136 int check_disk (double usp, uintmax_t free_disk, double uisp);
137 int walk_parameter_list (struct parameter_list *list, const char *name);
138 void print_help (void);
139 void print_usage (void);
141 uintmax_t w_df = 0;
142 uintmax_t c_df = 0;
143 double w_dfp = -1.0;
144 double c_dfp = -1.0;
145 double w_idfp = -1.0;
146 double c_idfp = -1.0;
147 char *path;
148 char *exclude_device;
149 char *units;
150 uintmax_t mult = 1024 * 1024;
151 int verbose = 0;
152 int erronly = FALSE;
153 int display_mntp = FALSE;
157 int
158 main (int argc, char **argv)
159 {
160 double usp = -1.0, uisp = -1.0;
161 int result = STATE_UNKNOWN;
162 int disk_result = STATE_UNKNOWN;
163 char file_system[MAX_INPUT_BUFFER];
164 char *output;
165 char *details;
166 char *perf;
167 uintmax_t psize;
168 float free_space, free_space_pct, total_space, inode_space_pct;
170 struct mount_entry *me;
171 struct fs_usage fsp;
172 struct parameter_list *temp_list;
174 output = strdup (" - free space:");
175 details = strdup ("");
176 perf = strdup ("");
178 setlocale (LC_ALL, "");
179 bindtextdomain (PACKAGE, LOCALEDIR);
180 textdomain (PACKAGE);
182 mount_list = read_file_system_list (0);
184 if (process_arguments (argc, argv) == ERROR)
185 usage4 (_("Could not parse arguments"));
187 /* if a list of paths has been selected, preseed the list with
188 * the longest matching filesystem name by iterating across
189 * the mountlist once ahead of time. this will allow a query on
190 * "/var/log" to return information about "/var" if no "/var/log"
191 * filesystem exists, etc. this is the default behavior already
192 * with df-based checks, but for systems with their own space
193 * checking routines, this should make them more consistent.
194 */
195 if(path_select_list){
196 for (me = mount_list; me; me = me->me_next) {
197 walk_parameter_list(path_select_list, me->me_mountdir);
198 walk_parameter_list(path_select_list, me->me_devname);
199 }
200 /* now pretend we never saw anything, but keep found_len.
201 * thus future searches will only match the best match */
202 for (temp_list = path_select_list; temp_list; temp_list=temp_list->name_next){
203 temp_list->found=0;
204 }
205 }
207 /* for every mount entry */
208 for (me = mount_list; me; me = me->me_next) {
209 /* if there's a list of paths to select, the current mount
210 * entry matches in path or device name, get fs usage */
211 if (path_select_list &&
212 (walk_parameter_list (path_select_list, me->me_mountdir) ||
213 walk_parameter_list (path_select_list, me->me_devname) ) ) {
214 get_fs_usage (me->me_mountdir, me->me_devname, &fsp);
215 /* else if there's a list of paths/devices to select (but
216 * we didn't match above) skip to the next mount entry */
217 } else if (path_select_list) {
218 continue;
219 /* skip remote filesystems if we're not interested in them */
220 } else if (me->me_remote && show_local_fs) {
221 continue;
222 /* skip pseudo fs's if we haven't asked for all fs's */
223 } else if (me->me_dummy && !show_all_fs) {
224 continue;
225 /* skip excluded fstypes */
226 } else if (fs_exclude_list && np_find_name (fs_exclude_list, me->me_type)) {
227 continue;
228 /* skip excluded fs's */
229 } else if (dp_exclude_list &&
230 (np_find_name (dp_exclude_list, me->me_devname) ||
231 np_find_name (dp_exclude_list, me->me_mountdir))) {
232 continue;
233 /* otherwise, get fs usage */
234 } else {
235 get_fs_usage (me->me_mountdir, me->me_devname, &fsp);
236 }
238 if (fsp.fsu_blocks && strcmp ("none", me->me_mountdir)) {
239 usp = (double)(fsp.fsu_blocks - fsp.fsu_bavail) * 100 / fsp.fsu_blocks;
240 uisp = (double)(fsp.fsu_files - fsp.fsu_ffree) * 100 / fsp.fsu_files;
241 disk_result = check_disk (usp, fsp.fsu_bavail, uisp);
244 result = max_state (disk_result, result);
245 psize = fsp.fsu_blocks*fsp.fsu_blocksize/mult;
248 /* Moved this computation up here so we can add it
249 * to perf */
250 inode_space_pct = (float)fsp.fsu_ffree*100/fsp.fsu_files;
253 asprintf (&perf, "%s %s", perf,
254 perfdata ((!strcmp(file_system, "none") || display_mntp) ? me->me_devname : me->me_mountdir,
255 psize-(fsp.fsu_bavail*fsp.fsu_blocksize/mult), units,
256 TRUE, min ((uintmax_t)psize-(uintmax_t)w_df, (uintmax_t)((1.0-w_dfp/100.0)*psize)),
257 TRUE, min ((uintmax_t)psize-(uintmax_t)c_df, (uintmax_t)((1.0-c_dfp/100.0)*psize)),
258 TRUE, inode_space_pct,
260 TRUE, psize));
261 if (disk_result==STATE_OK && erronly && !verbose)
262 continue;
264 free_space = (float)fsp.fsu_bavail*fsp.fsu_blocksize/mult;
265 free_space_pct = (float)fsp.fsu_bavail*100/fsp.fsu_blocks;
266 total_space = (float)fsp.fsu_blocks*fsp.fsu_blocksize/mult;
267 if (disk_result!=STATE_OK || verbose>=0)
268 asprintf (&output, ("%s %s %.0f %s (%.0f%% inode=%.0f%%);"),
269 output,
270 (!strcmp(file_system, "none") || display_mntp) ? me->me_devname : me->me_mountdir,
271 free_space,
272 units,
273 free_space_pct,
274 inode_space_pct);
276 asprintf (&details, _("%s\n\
277 %.0f of %.0f %s (%.0f%% inode=%.0f%%) free on %s (type %s mounted on %s) warn:%lu crit:%lu warn%%:%.0f%% crit%%:%.0f%%"),
278 details, free_space, total_space, units, free_space_pct, inode_space_pct,
279 me->me_devname, me->me_type, me->me_mountdir,
280 (unsigned long)w_df, (unsigned long)c_df, w_dfp, c_dfp);
282 }
284 }
286 if (verbose > 2)
287 asprintf (&output, "%s%s", output, details);
289 /* Override result if paths specified and not found */
290 temp_list = path_select_list;
291 while (temp_list) {
292 if (!temp_list->found) {
293 asprintf (&output, _("%s [%s not found]"), output, temp_list->name);
294 result = STATE_CRITICAL;
295 }
296 temp_list = temp_list->name_next;
297 }
299 printf ("DISK %s%s|%s\n", state_text (result), output, perf);
300 return result;
301 }
305 /* process command-line arguments */
306 int
307 process_arguments (int argc, char **argv)
308 {
309 int c;
310 struct parameter_list *se;
311 struct parameter_list **pathtail = &path_select_list;
312 struct parameter_list *temp_list;
313 int result = OK;
314 struct stat *stat_buf;
316 unsigned long l;
318 int option = 0;
319 static struct option longopts[] = {
320 {"timeout", required_argument, 0, 't'},
321 {"warning", required_argument, 0, 'w'},
322 {"critical", required_argument, 0, 'c'},
323 {"iwarning", required_argument, 0, 'W'},
324 /* Dang, -C is taken. We might want to reshuffle this. */
325 {"icritical", required_argument, 0, 'K'},
326 {"local", required_argument, 0, 'l'},
327 {"kilobytes", required_argument, 0, 'k'},
328 {"megabytes", required_argument, 0, 'm'},
329 {"units", required_argument, 0, 'u'},
330 {"path", required_argument, 0, 'p'},
331 {"partition", required_argument, 0, 'p'},
332 {"exclude_device", required_argument, 0, 'x'},
333 {"exclude-type", required_argument, 0, 'X'},
334 {"mountpoint", no_argument, 0, 'M'},
335 {"errors-only", no_argument, 0, 'e'},
336 {"verbose", no_argument, 0, 'v'},
337 {"quiet", no_argument, 0, 'q'},
338 {"clear", no_argument, 0, 'C'},
339 {"version", no_argument, 0, 'V'},
340 {"help", no_argument, 0, 'h'},
341 {0, 0, 0, 0}
342 };
344 if (argc < 2)
345 return ERROR;
347 np_add_name(&fs_exclude_list, "iso9660");
349 for (c = 1; c < argc; c++)
350 if (strcmp ("-to", argv[c]) == 0)
351 strcpy (argv[c], "-t");
353 while (1) {
354 c = getopt_long (argc, argv, "+?VqhveCt:c:w:K:W:u:p:x:X:mklM", longopts, &option);
356 if (c == -1 || c == EOF)
357 break;
359 switch (c) {
360 case 't': /* timeout period */
361 if (is_integer (optarg)) {
362 timeout_interval = atoi (optarg);
363 break;
364 }
365 else {
366 usage2 (_("Timeout interval must be a positive integer"), optarg);
367 }
368 case 'w': /* warning threshold */
369 if (is_intnonneg (optarg)) {
370 w_df = atoi (optarg);
371 break;
372 }
373 else if (strpbrk (optarg, ",:") &&
374 strstr (optarg, "%") &&
375 sscanf (optarg, "%lu%*[:,]%lf%%", &l, &w_dfp) == 2) {
376 w_df = (uintmax_t)l;
377 break;
378 }
379 else if (strstr (optarg, "%") && sscanf (optarg, "%lf%%", &w_dfp) == 1) {
380 break;
381 }
382 else {
383 usage4 (_("Warning threshold must be integer or percentage!"));
384 }
385 case 'c': /* critical threshold */
386 if (is_intnonneg (optarg)) {
387 c_df = atoi (optarg);
388 break;
389 }
390 else if (strpbrk (optarg, ",:") &&
391 strstr (optarg, "%") &&
392 sscanf (optarg, "%lu%*[,:]%lf%%", &l, &c_dfp) == 2) {
393 c_df = (uintmax_t)l;
394 break;
395 }
396 else if (strstr (optarg, "%") && sscanf (optarg, "%lf%%", &c_dfp) == 1) {
397 break;
398 }
399 else {
400 usage4 (_("Critical threshold must be integer or percentage!"));
401 }
404 case 'W': /* warning inode threshold */
405 if (strstr (optarg, "%") && sscanf (optarg, "%lf%%", &w_idfp) == 1) {
406 break;
407 }
408 else {
409 usage (_("Warning inode threshold must be percentage!\n"));
410 }
411 case 'K': /* kritical inode threshold */
412 if (strstr (optarg, "%") && sscanf (optarg, "%lf%%", &c_idfp) == 1) {
413 break;
414 }
415 else {
416 usage (_("Critical inode threshold must be percentage!\n"));
417 }
418 case 'u':
419 if (units)
420 free(units);
421 if (! strcmp (optarg, "bytes")) {
422 mult = (uintmax_t)1;
423 units = strdup ("B");
424 } else if (! strcmp (optarg, "kB")) {
425 mult = (uintmax_t)1024;
426 units = strdup ("kB");
427 } else if (! strcmp (optarg, "MB")) {
428 mult = (uintmax_t)1024 * 1024;
429 units = strdup ("MB");
430 } else if (! strcmp (optarg, "GB")) {
431 mult = (uintmax_t)1024 * 1024 * 1024;
432 units = strdup ("GB");
433 } else if (! strcmp (optarg, "TB")) {
434 mult = (uintmax_t)1024 * 1024 * 1024 * 1024;
435 units = strdup ("TB");
436 } else {
437 die (STATE_UNKNOWN, _("unit type %s not known\n"), optarg);
438 }
439 if (units == NULL)
440 die (STATE_UNKNOWN, _("failed allocating storage for '%s'\n"), "units");
441 break;
442 case 'k': /* display mountpoint */
443 mult = 1024;
444 if (units)
445 free(units);
446 units = strdup ("kB");
447 break;
448 case 'm': /* display mountpoint */
449 mult = 1024 * 1024;
450 if (units)
451 free(units);
452 units = strdup ("MB");
453 break;
454 case 'l':
455 show_local_fs = 1;
456 break;
457 case 'p': /* select path */
458 se = (struct parameter_list *) malloc (sizeof (struct parameter_list));
459 se->name = optarg;
460 se->name_next = NULL;
461 se->w_df = w_df;
462 se->c_df = c_df;
463 se->w_dfp = w_dfp;
464 se->c_dfp = c_dfp;
465 se->w_idfp = w_idfp;
466 se->c_idfp = c_idfp;
467 se->found = 0;
468 se->found_len = 0;
469 *pathtail = se;
470 pathtail = &se->name_next;
471 break;
472 case 'x': /* exclude path or partition */
473 np_add_name(&dp_exclude_list, optarg);
474 break;
475 case 'X': /* exclude file system type */
476 np_add_name(&fs_exclude_list, optarg);
477 break;
478 case 'v': /* verbose */
479 verbose++;
480 break;
481 case 'q': /* verbose */
482 verbose--;
483 break;
484 case 'e':
485 erronly = TRUE;
486 break;
487 case 'M': /* display mountpoint */
488 display_mntp = TRUE;
489 break;
490 case 'C':
491 w_df = 0;
492 c_df = 0;
493 w_dfp = -1.0;
494 c_dfp = -1.0;
495 w_idfp = -1.0;
496 c_idfp = -1.0;
497 break;
498 case 'V': /* version */
499 print_revision (progname, revision);
500 exit (STATE_OK);
501 case 'h': /* help */
502 print_help ();
503 exit (STATE_OK);
504 case '?': /* help */
505 usage (_("Unknown argument"));
506 }
507 }
509 /* Support for "check_disk warn crit [fs]" with thresholds at used level */
510 c = optind;
511 if (w_dfp < 0 && argc > c && is_intnonneg (argv[c]))
512 w_dfp = (100.0 - atof (argv[c++]));
514 if (c_dfp < 0 && argc > c && is_intnonneg (argv[c]))
515 c_dfp = (100.0 - atof (argv[c++]));
517 if (argc > c && path == NULL) {
518 se = (struct parameter_list *) malloc (sizeof (struct parameter_list));
519 se->name = strdup (argv[c++]);
520 se->name_next = NULL;
521 se->w_df = w_df;
522 se->c_df = c_df;
523 se->w_dfp = w_dfp;
524 se->c_dfp = c_dfp;
525 se->w_idfp = w_idfp;
526 se->c_idfp = c_idfp;
527 se->found =0;
528 se->found_len = 0;
529 *pathtail = se;
530 }
532 if (path_select_list) {
533 temp_list = path_select_list;
534 stat_buf = malloc(sizeof *stat_buf);
535 while (temp_list) {
536 /* Stat each entry to check that dir exists */
537 if (stat (temp_list->name, &stat_buf[0])) {
538 printf("DISK %s - ", _("CRITICAL"));
539 die (STATE_CRITICAL, _("%s does not exist\n"), temp_list->name);
540 }
541 if (validate_arguments (temp_list->w_df,
542 temp_list->c_df,
543 temp_list->w_dfp,
544 temp_list->c_dfp,
545 temp_list->w_idfp,
546 temp_list->c_idfp,
547 temp_list->name) == ERROR)
548 result = ERROR;
549 temp_list = temp_list->name_next;
550 }
551 free(stat_buf);
552 return result;
553 } else {
554 return validate_arguments (w_df, c_df, w_dfp, c_dfp, w_idfp, c_idfp, NULL);
555 }
556 }
560 void
561 print_path (const char *mypath)
562 {
563 if (mypath == NULL)
564 printf ("\n");
565 else
566 printf (_(" for %s\n"), mypath);
568 return;
569 }
573 int
574 validate_arguments (uintmax_t w, uintmax_t c, double wp, double cp, double iwp, double icp, char *mypath)
575 {
576 if (w < 0 && c < 0 && wp < 0.0 && cp < 0.0) {
577 printf (_("INPUT ERROR: No thresholds specified"));
578 print_path (mypath);
579 return ERROR;
580 }
581 else if ((wp >= 0.0 || cp >= 0.0) &&
582 (wp < 0.0 || cp < 0.0 || wp > 100.0 || cp > 100.0 || cp > wp)) {
583 printf (_("\
584 INPUT ERROR: C_DFP (%f) should be less than W_DFP (%.1f) and both should be between zero and 100 percent, inclusive"),
585 cp, wp);
586 print_path (mypath);
587 return ERROR;
588 }
589 else if ((iwp >= 0.0 || icp >= 0.0) &&
590 (iwp < 0.0 || icp < 0.0 || iwp > 100.0 || icp > 100.0 || icp > iwp)) {
591 printf (_("\
592 INPUT ERROR: C_IDFP (%f) should be less than W_IDFP (%.1f) and both should be between zero and 100 percent, inclusive"),
593 icp, iwp);
594 print_path (mypath);
595 return ERROR;
596 }
597 else if ((w > 0 || c > 0) && (w == 0 || c == 0 || c > w)) {
598 printf (_("\
599 INPUT ERROR: C_DF (%lu) should be less than W_DF (%lu) and both should be greater than zero"),
600 (unsigned long)c, (unsigned long)w);
601 print_path (mypath);
602 return ERROR;
603 }
605 if (units == NULL) {
606 units = strdup ("MB");
607 mult = (uintmax_t)1024 * 1024;
608 }
609 return OK;
610 }
614 int
616 check_disk (double usp, uintmax_t free_disk, double uisp)
617 {
618 int result = STATE_UNKNOWN;
619 /* check the percent used space against thresholds */
620 if (usp >= 0.0 && c_dfp >=0.0 && usp >= (100.0 - c_dfp))
621 result = STATE_CRITICAL;
622 else if (uisp >= 0.0 && c_idfp >=0.0 && uisp >= (100.0 - c_idfp))
623 result = STATE_CRITICAL;
624 else if (c_df > 0 && free_disk <= c_df)
625 result = STATE_CRITICAL;
626 else if (usp >= 0.0 && w_dfp >=0.0 && usp >= (100.0 - w_dfp))
627 result = STATE_WARNING;
628 else if (uisp >= 0.0 && w_idfp >=0.0 && uisp >= (100.0 - w_idfp))
629 result = STATE_WARNING;
630 else if (w_df > 0 && free_disk <= w_df)
631 result = STATE_WARNING;
632 else if (usp >= 0.0)
633 result = STATE_OK;
634 return result;
635 }
639 int
640 walk_parameter_list (struct parameter_list *list, const char *name)
641 {
642 int name_len;
643 name_len = strlen(name);
644 while (list) {
645 /* if the paths match up to the length of the mount path,
646 * AND if the mount path name is longer than the longest
647 * found match, we have a new winner */
648 if (name_len >= list->found_len &&
649 ! strncmp(list->name, name, name_len)) {
650 list->found = 1;
651 list->found_len = name_len;
652 /* if required for parameter_lists that have not saved w_df, etc (eg exclude lists) */
653 if (list->w_df) w_df = list->w_df;
654 if (list->c_df) c_df = list->c_df;
655 if (list->w_dfp>=0.0) w_dfp = list->w_dfp;
656 if (list->c_dfp>=0.0) c_dfp = list->c_dfp;
657 return TRUE;
658 }
659 list = list->name_next;
660 }
661 return FALSE;
662 }
666 void
667 print_help (void)
668 {
669 print_revision (progname, revision);
671 printf ("Copyright (c) 1999 Ethan Galstad <nagios@nagios.org>\n");
672 printf (COPYRIGHT, copyright, email);
674 printf ("%s\n", _("This plugin checks the amount of used disk space on a mounted file system"));
675 printf ("%s\n", _("and generates an alert if free space is less than one of the threshold values"));
677 printf ("\n\n");
679 print_usage ();
681 printf (_(UT_HELP_VRSN));
683 printf (" %s\n", "-w, --warning=INTEGER");
684 printf (" %s\n", _("Exit with WARNING status if less than INTEGER units of disk are free"));
685 printf (" %s\n", "-w, --warning=PERCENT%");
686 printf (" %s\n", _("Exit with WARNING status if less than PERCENT of disk space is free"));
687 printf (" %s\n", "-W, --iwarning=PERCENT%");
688 printf (" %s\n", _("Exit with WARNING status if less than PERCENT of inode space is free"));
689 printf (" %s\n", "-K, --icritical=PERCENT%");
690 printf (" %s\n", _("Exit with CRITICAL status if less than PERCENT of inode space is free"));
691 printf (" %s\n", "-c, --critical=INTEGER");
692 printf (" %s\n", _("Exit with CRITICAL status if less than INTEGER units of disk are free"));
693 printf (" %s\n", "-c, --critical=PERCENT%");
694 printf (" %s\n", _("Exit with CRITCAL status if less than PERCENT of disk space is free"));
695 printf (" %s\n", "-C, --clear");
696 printf (" %s\n", _("Clear thresholds"));
697 printf (" %s\n", "-u, --units=STRING");
698 printf (" %s\n", _("Choose bytes, kB, MB, GB, TB (default: MB)"));
699 printf (" %s\n", "-k, --kilobytes");
700 printf (" %s\n", _("Same as '--units kB'"));
701 printf (" %s\n", "-m, --megabytes");
702 printf (" %s\n", _("Same as '--units MB'"));
703 printf (" %s\n", "-l, --local");
704 printf (" %s\n", _("Only check local filesystems"));
705 printf (" %s\n", "-p, --path=PATH, --partition=PARTITION");
706 printf (" %s\n", _("Path or partition (may be repeated)"));
707 printf (" %s\n", "-x, --exclude_device=PATH <STRING>");
708 printf (" %s\n", _("Ignore device (only works if -p unspecified)"));
709 printf (" %s\n", _("-X, --exclude-type=TYPE <STRING>"));
710 printf (" %s\n", _("Ignore all filesystems of indicated type (may be repeated)"));
711 printf (" %s\n", "-m, --mountpoint");
712 printf (" %s\n", _("Display the mountpoint instead of the partition"));
713 printf (" %s\n", "-e, --errors-only");
714 printf (" %s\n", _("Display only devices/mountpoints with errors"));
715 printf (_(UT_TIMEOUT), DEFAULT_SOCKET_TIMEOUT);
716 printf (_(UT_VERBOSE));
717 printf ("\n");
718 printf ("%s\n", _("Examples:"));
719 printf (" %s\n", "check_disk -w 10% -c 5% -p /tmp -p /var -C -w 100000 -c 50000 -p /");
720 printf (" %s\n", _("Checks /tmp and /var at 10% and 5%, and / at 100MB and 50MB"));
721 printf (_(UT_SUPPORT));
722 }
726 void
727 print_usage (void)
728 {
729 printf (_("Usage:"));
730 printf (" %s -w limit -c limit [-p path | -x device] [-t timeout]", progname);
731 printf ("[-m] [-e] [-W limit] [-K limit] [-v] [-q]\n");
732 }