8e9c1fceabc39a773c446604872ff76b46a1bbcc
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 /* Linked list of filesystem types to display.
78 If `fs_select_list' is NULL, list all types.
79 This table is generated dynamically from command-line options,
80 rather than hardcoding into the program what it thinks are the
81 valid filesystem types; let the user specify any filesystem type
82 they want to, and if there are any filesystems of that type, they
83 will be shown.
85 Some filesystem types:
86 4.2 4.3 ufs nfs swap ignore io vm efs dbg */
88 /* static struct parameter_list *fs_select_list; */
90 /* Linked list of filesystem types to omit.
91 If the list is empty, don't exclude any types. */
93 static struct name_list *fs_exclude_list;
95 static struct name_list *dp_exclude_list;
97 static struct parameter_list *path_select_list;
99 /* Linked list of mounted filesystems. */
100 static struct mount_entry *mount_list;
102 /* For long options that have no equivalent short option, use a
103 non-character as a pseudo short option, starting with CHAR_MAX + 1. */
104 enum
105 {
106 SYNC_OPTION = CHAR_MAX + 1,
107 NO_SYNC_OPTION,
108 BLOCK_SIZE_OPTION
109 };
111 #ifdef _AIX
112 #pragma alloca
113 #endif
115 /* Linked list of mounted filesystems. */
116 static struct mount_entry *mount_list;
118 int process_arguments (int, char **);
119 void print_path (const char *mypath);
120 int validate_arguments (uintmax_t, uintmax_t, double, double, double, double, char *);
121 int check_disk (double usp, uintmax_t free_disk, double uisp);
122 int walk_parameter_list (struct parameter_list *list, const char *name);
123 void print_help (void);
124 void print_usage (void);
126 uintmax_t w_df = 0;
127 uintmax_t c_df = 0;
128 double w_dfp = -1.0;
129 double c_dfp = -1.0;
130 double w_idfp = -1.0;
131 double c_idfp = -1.0;
132 char *path;
133 char *exclude_device;
134 char *units;
135 uintmax_t mult = 1024 * 1024;
136 int verbose = 0;
137 int erronly = FALSE;
138 int display_mntp = FALSE;
142 int
143 main (int argc, char **argv)
144 {
145 double usp = -1.0, uisp = -1.0;
146 int result = STATE_UNKNOWN;
147 int disk_result = STATE_UNKNOWN;
148 char file_system[MAX_INPUT_BUFFER];
149 char *output;
150 char *details;
151 char *perf;
152 uintmax_t psize;
153 float free_space, free_space_pct, total_space, inode_space_pct;
155 struct mount_entry *me;
156 struct fs_usage fsp;
157 struct parameter_list *temp_list;
159 output = strdup (" - free space:");
160 details = strdup ("");
161 perf = strdup ("");
163 setlocale (LC_ALL, "");
164 bindtextdomain (PACKAGE, LOCALEDIR);
165 textdomain (PACKAGE);
167 mount_list = read_file_system_list (0);
169 if (process_arguments (argc, argv) == ERROR)
170 usage4 (_("Could not parse arguments"));
172 /* if a list of paths has been selected, preseed the list with
173 * the longest matching filesystem name by iterating across
174 * the mountlist once ahead of time. this will allow a query on
175 * "/var/log" to return information about "/var" if no "/var/log"
176 * filesystem exists, etc. this is the default behavior already
177 * with df-based checks, but for systems with their own space
178 * checking routines, this should make them more consistent.
179 */
180 if(path_select_list){
181 for (me = mount_list; me; me = me->me_next) {
182 walk_parameter_list(path_select_list, me->me_mountdir);
183 walk_parameter_list(path_select_list, me->me_devname);
184 }
185 /* now pretend we never saw anything, but keep found_len.
186 * thus future searches will only match the best match */
187 for (temp_list = path_select_list; temp_list; temp_list=temp_list->name_next){
188 temp_list->found=0;
189 }
190 }
192 /* for every mount entry */
193 for (me = mount_list; me; me = me->me_next) {
194 /* if there's a list of paths to select, the current mount
195 * entry matches in path or device name, get fs usage */
196 if (path_select_list &&
197 (walk_parameter_list (path_select_list, me->me_mountdir) ||
198 walk_parameter_list (path_select_list, me->me_devname) ) ) {
199 get_fs_usage (me->me_mountdir, me->me_devname, &fsp);
200 /* else if there's a list of paths/devices to select (but
201 * we didn't match above) skip to the next mount entry */
202 } else if (path_select_list) {
203 continue;
204 /* skip remote filesystems if we're not interested in them */
205 } else if (me->me_remote && show_local_fs) {
206 continue;
207 /* skip pseudo fs's if we haven't asked for all fs's */
208 } else if (me->me_dummy && !show_all_fs) {
209 continue;
210 /* skip excluded fstypes */
211 } else if (fs_exclude_list && np_find_name (fs_exclude_list, me->me_type)) {
212 continue;
213 /* skip excluded fs's */
214 } else if (dp_exclude_list &&
215 (np_find_name (dp_exclude_list, me->me_devname) ||
216 np_find_name (dp_exclude_list, me->me_mountdir))) {
217 continue;
218 /* otherwise, get fs usage */
219 } else {
220 get_fs_usage (me->me_mountdir, me->me_devname, &fsp);
221 }
223 if (fsp.fsu_blocks && strcmp ("none", me->me_mountdir)) {
224 usp = (double)(fsp.fsu_blocks - fsp.fsu_bavail) * 100 / fsp.fsu_blocks;
225 uisp = (double)(fsp.fsu_files - fsp.fsu_ffree) * 100 / fsp.fsu_files;
226 disk_result = check_disk (usp, fsp.fsu_bavail, uisp);
229 result = max_state (disk_result, result);
230 psize = fsp.fsu_blocks*fsp.fsu_blocksize/mult;
233 /* Moved this computation up here so we can add it
234 * to perf */
235 inode_space_pct = (float)fsp.fsu_ffree*100/fsp.fsu_files;
238 asprintf (&perf, "%s %s", perf,
239 perfdata ((!strcmp(file_system, "none") || display_mntp) ? me->me_devname : me->me_mountdir,
240 psize-(fsp.fsu_bavail*fsp.fsu_blocksize/mult), units,
241 TRUE, min ((uintmax_t)psize-(uintmax_t)w_df, (uintmax_t)((1.0-w_dfp/100.0)*psize)),
242 TRUE, min ((uintmax_t)psize-(uintmax_t)c_df, (uintmax_t)((1.0-c_dfp/100.0)*psize)),
243 TRUE, inode_space_pct,
245 TRUE, psize));
246 if (disk_result==STATE_OK && erronly && !verbose)
247 continue;
249 free_space = (float)fsp.fsu_bavail*fsp.fsu_blocksize/mult;
250 free_space_pct = (float)fsp.fsu_bavail*100/fsp.fsu_blocks;
251 total_space = (float)fsp.fsu_blocks*fsp.fsu_blocksize/mult;
252 if (disk_result!=STATE_OK || verbose>=0)
253 asprintf (&output, ("%s %s %.0f %s (%.0f%% inode=%.0f%%);"),
254 output,
255 (!strcmp(file_system, "none") || display_mntp) ? me->me_devname : me->me_mountdir,
256 free_space,
257 units,
258 free_space_pct,
259 inode_space_pct);
261 asprintf (&details, _("%s\n\
262 %.0f of %.0f %s (%.0f%% inode=%.0f%%) free on %s (type %s mounted on %s) warn:%lu crit:%lu warn%%:%.0f%% crit%%:%.0f%%"),
263 details, free_space, total_space, units, free_space_pct, inode_space_pct,
264 me->me_devname, me->me_type, me->me_mountdir,
265 (unsigned long)w_df, (unsigned long)c_df, w_dfp, c_dfp);
267 }
269 }
271 if (verbose > 2)
272 asprintf (&output, "%s%s", output, details);
274 /* Override result if paths specified and not found */
275 temp_list = path_select_list;
276 while (temp_list) {
277 if (!temp_list->found) {
278 asprintf (&output, _("%s [%s not found]"), output, temp_list->name);
279 result = STATE_CRITICAL;
280 }
281 temp_list = temp_list->name_next;
282 }
284 printf ("DISK %s%s|%s\n", state_text (result), output, perf);
285 return result;
286 }
290 /* process command-line arguments */
291 int
292 process_arguments (int argc, char **argv)
293 {
294 int c;
295 struct parameter_list *se;
296 struct parameter_list **pathtail = &path_select_list;
297 struct parameter_list *temp_list;
298 int result = OK;
299 struct stat *stat_buf;
301 unsigned long l;
303 int option = 0;
304 static struct option longopts[] = {
305 {"timeout", required_argument, 0, 't'},
306 {"warning", required_argument, 0, 'w'},
307 {"critical", required_argument, 0, 'c'},
308 {"iwarning", required_argument, 0, 'W'},
309 /* Dang, -C is taken. We might want to reshuffle this. */
310 {"icritical", required_argument, 0, 'K'},
311 {"local", required_argument, 0, 'l'},
312 {"kilobytes", required_argument, 0, 'k'},
313 {"megabytes", required_argument, 0, 'm'},
314 {"units", required_argument, 0, 'u'},
315 {"path", required_argument, 0, 'p'},
316 {"partition", required_argument, 0, 'p'},
317 {"exclude_device", required_argument, 0, 'x'},
318 {"exclude-type", required_argument, 0, 'X'},
319 {"mountpoint", no_argument, 0, 'M'},
320 {"errors-only", no_argument, 0, 'e'},
321 {"verbose", no_argument, 0, 'v'},
322 {"quiet", no_argument, 0, 'q'},
323 {"clear", no_argument, 0, 'C'},
324 {"version", no_argument, 0, 'V'},
325 {"help", no_argument, 0, 'h'},
326 {0, 0, 0, 0}
327 };
329 if (argc < 2)
330 return ERROR;
332 np_add_name(&fs_exclude_list, "iso9660");
334 for (c = 1; c < argc; c++)
335 if (strcmp ("-to", argv[c]) == 0)
336 strcpy (argv[c], "-t");
338 while (1) {
339 c = getopt_long (argc, argv, "+?VqhveCt:c:w:K:W:u:p:x:X:mklM", longopts, &option);
341 if (c == -1 || c == EOF)
342 break;
344 switch (c) {
345 case 't': /* timeout period */
346 if (is_integer (optarg)) {
347 timeout_interval = atoi (optarg);
348 break;
349 }
350 else {
351 usage2 (_("Timeout interval must be a positive integer"), optarg);
352 }
353 case 'w': /* warning threshold */
354 if (is_intnonneg (optarg)) {
355 w_df = atoi (optarg);
356 break;
357 }
358 else if (strpbrk (optarg, ",:") &&
359 strstr (optarg, "%") &&
360 sscanf (optarg, "%lu%*[:,]%lf%%", &l, &w_dfp) == 2) {
361 w_df = (uintmax_t)l;
362 break;
363 }
364 else if (strstr (optarg, "%") && sscanf (optarg, "%lf%%", &w_dfp) == 1) {
365 break;
366 }
367 else {
368 usage4 (_("Warning threshold must be integer or percentage!"));
369 }
370 case 'c': /* critical threshold */
371 if (is_intnonneg (optarg)) {
372 c_df = atoi (optarg);
373 break;
374 }
375 else if (strpbrk (optarg, ",:") &&
376 strstr (optarg, "%") &&
377 sscanf (optarg, "%lu%*[,:]%lf%%", &l, &c_dfp) == 2) {
378 c_df = (uintmax_t)l;
379 break;
380 }
381 else if (strstr (optarg, "%") && sscanf (optarg, "%lf%%", &c_dfp) == 1) {
382 break;
383 }
384 else {
385 usage4 (_("Critical threshold must be integer or percentage!"));
386 }
389 case 'W': /* warning inode threshold */
390 if (strstr (optarg, "%") && sscanf (optarg, "%lf%%", &w_idfp) == 1) {
391 break;
392 }
393 else {
394 usage (_("Warning inode threshold must be percentage!\n"));
395 }
396 case 'K': /* kritical inode threshold */
397 if (strstr (optarg, "%") && sscanf (optarg, "%lf%%", &c_idfp) == 1) {
398 break;
399 }
400 else {
401 usage (_("Critical inode threshold must be percentage!\n"));
402 }
403 case 'u':
404 if (units)
405 free(units);
406 if (! strcmp (optarg, "bytes")) {
407 mult = (uintmax_t)1;
408 units = strdup ("B");
409 } else if (! strcmp (optarg, "kB")) {
410 mult = (uintmax_t)1024;
411 units = strdup ("kB");
412 } else if (! strcmp (optarg, "MB")) {
413 mult = (uintmax_t)1024 * 1024;
414 units = strdup ("MB");
415 } else if (! strcmp (optarg, "GB")) {
416 mult = (uintmax_t)1024 * 1024 * 1024;
417 units = strdup ("GB");
418 } else if (! strcmp (optarg, "TB")) {
419 mult = (uintmax_t)1024 * 1024 * 1024 * 1024;
420 units = strdup ("TB");
421 } else {
422 die (STATE_UNKNOWN, _("unit type %s not known\n"), optarg);
423 }
424 if (units == NULL)
425 die (STATE_UNKNOWN, _("failed allocating storage for '%s'\n"), "units");
426 break;
427 case 'k': /* display mountpoint */
428 mult = 1024;
429 if (units)
430 free(units);
431 units = strdup ("kB");
432 break;
433 case 'm': /* display mountpoint */
434 mult = 1024 * 1024;
435 if (units)
436 free(units);
437 units = strdup ("MB");
438 break;
439 case 'l':
440 show_local_fs = 1;
441 break;
442 case 'p': /* select path */
443 se = (struct parameter_list *) malloc (sizeof (struct parameter_list));
444 se->name = optarg;
445 se->name_next = NULL;
446 se->w_df = w_df;
447 se->c_df = c_df;
448 se->w_dfp = w_dfp;
449 se->c_dfp = c_dfp;
450 se->w_idfp = w_idfp;
451 se->c_idfp = c_idfp;
452 se->found = 0;
453 se->found_len = 0;
454 *pathtail = se;
455 pathtail = &se->name_next;
456 break;
457 case 'x': /* exclude path or partition */
458 np_add_name(&dp_exclude_list, optarg);
459 break;
460 case 'X': /* exclude file system type */
461 np_add_name(&fs_exclude_list, optarg);
462 break;
463 case 'v': /* verbose */
464 verbose++;
465 break;
466 case 'q': /* verbose */
467 verbose--;
468 break;
469 case 'e':
470 erronly = TRUE;
471 break;
472 case 'M': /* display mountpoint */
473 display_mntp = TRUE;
474 break;
475 case 'C':
476 w_df = 0;
477 c_df = 0;
478 w_dfp = -1.0;
479 c_dfp = -1.0;
480 w_idfp = -1.0;
481 c_idfp = -1.0;
482 break;
483 case 'V': /* version */
484 print_revision (progname, revision);
485 exit (STATE_OK);
486 case 'h': /* help */
487 print_help ();
488 exit (STATE_OK);
489 case '?': /* help */
490 usage (_("Unknown argument"));
491 }
492 }
494 /* Support for "check_disk warn crit [fs]" with thresholds at used level */
495 c = optind;
496 if (w_dfp < 0 && argc > c && is_intnonneg (argv[c]))
497 w_dfp = (100.0 - atof (argv[c++]));
499 if (c_dfp < 0 && argc > c && is_intnonneg (argv[c]))
500 c_dfp = (100.0 - atof (argv[c++]));
502 if (argc > c && path == NULL) {
503 se = (struct parameter_list *) malloc (sizeof (struct parameter_list));
504 se->name = strdup (argv[c++]);
505 se->name_next = NULL;
506 se->w_df = w_df;
507 se->c_df = c_df;
508 se->w_dfp = w_dfp;
509 se->c_dfp = c_dfp;
510 se->w_idfp = w_idfp;
511 se->c_idfp = c_idfp;
512 se->found =0;
513 se->found_len = 0;
514 *pathtail = se;
515 }
517 if (path_select_list) {
518 temp_list = path_select_list;
519 stat_buf = malloc(sizeof *stat_buf);
520 while (temp_list) {
521 /* Stat each entry to check that dir exists */
522 if (stat (temp_list->name, &stat_buf[0])) {
523 printf("DISK %s - ", _("CRITICAL"));
524 die (STATE_CRITICAL, _("%s does not exist\n"), temp_list->name);
525 }
526 if (validate_arguments (temp_list->w_df,
527 temp_list->c_df,
528 temp_list->w_dfp,
529 temp_list->c_dfp,
530 temp_list->w_idfp,
531 temp_list->c_idfp,
532 temp_list->name) == ERROR)
533 result = ERROR;
534 temp_list = temp_list->name_next;
535 }
536 free(stat_buf);
537 return result;
538 } else {
539 return validate_arguments (w_df, c_df, w_dfp, c_dfp, w_idfp, c_idfp, NULL);
540 }
541 }
545 void
546 print_path (const char *mypath)
547 {
548 if (mypath == NULL)
549 printf ("\n");
550 else
551 printf (_(" for %s\n"), mypath);
553 return;
554 }
558 int
559 validate_arguments (uintmax_t w, uintmax_t c, double wp, double cp, double iwp, double icp, char *mypath)
560 {
561 if (w < 0 && c < 0 && wp < 0.0 && cp < 0.0) {
562 printf (_("INPUT ERROR: No thresholds specified"));
563 print_path (mypath);
564 return ERROR;
565 }
566 else if ((wp >= 0.0 || cp >= 0.0) &&
567 (wp < 0.0 || cp < 0.0 || wp > 100.0 || cp > 100.0 || cp > wp)) {
568 printf (_("\
569 INPUT ERROR: C_DFP (%f) should be less than W_DFP (%.1f) and both should be between zero and 100 percent, inclusive"),
570 cp, wp);
571 print_path (mypath);
572 return ERROR;
573 }
574 else if ((iwp >= 0.0 || icp >= 0.0) &&
575 (iwp < 0.0 || icp < 0.0 || iwp > 100.0 || icp > 100.0 || icp > iwp)) {
576 printf (_("\
577 INPUT ERROR: C_IDFP (%f) should be less than W_IDFP (%.1f) and both should be between zero and 100 percent, inclusive"),
578 icp, iwp);
579 print_path (mypath);
580 return ERROR;
581 }
582 else if ((w > 0 || c > 0) && (w == 0 || c == 0 || c > w)) {
583 printf (_("\
584 INPUT ERROR: C_DF (%lu) should be less than W_DF (%lu) and both should be greater than zero"),
585 (unsigned long)c, (unsigned long)w);
586 print_path (mypath);
587 return ERROR;
588 }
590 if (units == NULL) {
591 units = strdup ("MB");
592 mult = (uintmax_t)1024 * 1024;
593 }
594 return OK;
595 }
599 int
601 check_disk (double usp, uintmax_t free_disk, double uisp)
602 {
603 int result = STATE_UNKNOWN;
604 /* check the percent used space against thresholds */
605 if (usp >= 0.0 && c_dfp >=0.0 && usp >= (100.0 - c_dfp))
606 result = STATE_CRITICAL;
607 else if (uisp >= 0.0 && c_idfp >=0.0 && uisp >= (100.0 - c_idfp))
608 result = STATE_CRITICAL;
609 else if (c_df > 0 && free_disk <= c_df)
610 result = STATE_CRITICAL;
611 else if (usp >= 0.0 && w_dfp >=0.0 && usp >= (100.0 - w_dfp))
612 result = STATE_WARNING;
613 else if (uisp >= 0.0 && w_idfp >=0.0 && uisp >= (100.0 - w_idfp))
614 result = STATE_WARNING;
615 else if (w_df > 0 && free_disk <= w_df)
616 result = STATE_WARNING;
617 else if (usp >= 0.0)
618 result = STATE_OK;
619 return result;
620 }
624 int
625 walk_parameter_list (struct parameter_list *list, const char *name)
626 {
627 int name_len;
628 name_len = strlen(name);
629 while (list) {
630 /* if the paths match up to the length of the mount path,
631 * AND if the mount path name is longer than the longest
632 * found match, we have a new winner */
633 if (name_len >= list->found_len &&
634 ! strncmp(list->name, name, name_len)) {
635 list->found = 1;
636 list->found_len = name_len;
637 /* if required for parameter_lists that have not saved w_df, etc (eg exclude lists) */
638 if (list->w_df) w_df = list->w_df;
639 if (list->c_df) c_df = list->c_df;
640 if (list->w_dfp>=0.0) w_dfp = list->w_dfp;
641 if (list->c_dfp>=0.0) c_dfp = list->c_dfp;
642 return TRUE;
643 }
644 list = list->name_next;
645 }
646 return FALSE;
647 }
651 void
652 print_help (void)
653 {
654 print_revision (progname, revision);
656 printf ("Copyright (c) 1999 Ethan Galstad <nagios@nagios.org>\n");
657 printf (COPYRIGHT, copyright, email);
659 printf ("%s\n", _("This plugin checks the amount of used disk space on a mounted file system"));
660 printf ("%s\n", _("and generates an alert if free space is less than one of the threshold values"));
662 printf ("\n\n");
664 print_usage ();
666 printf (_(UT_HELP_VRSN));
668 printf (" %s\n", "-w, --warning=INTEGER");
669 printf (" %s\n", _("Exit with WARNING status if less than INTEGER units of disk are free"));
670 printf (" %s\n", "-w, --warning=PERCENT%");
671 printf (" %s\n", _("Exit with WARNING status if less than PERCENT of disk space is free"));
672 printf (" %s\n", "-W, --iwarning=PERCENT%");
673 printf (" %s\n", _("Exit with WARNING status if less than PERCENT of inode space is free"));
674 printf (" %s\n", "-K, --icritical=PERCENT%");
675 printf (" %s\n", _("Exit with CRITICAL status if less than PERCENT of inode space is free"));
676 printf (" %s\n", "-c, --critical=INTEGER");
677 printf (" %s\n", _("Exit with CRITICAL status if less than INTEGER units of disk are free"));
678 printf (" %s\n", "-c, --critical=PERCENT%");
679 printf (" %s\n", _("Exit with CRITCAL status if less than PERCENT of disk space is free"));
680 printf (" %s\n", "-C, --clear");
681 printf (" %s\n", _("Clear thresholds"));
682 printf (" %s\n", "-u, --units=STRING");
683 printf (" %s\n", _("Choose bytes, kB, MB, GB, TB (default: MB)"));
684 printf (" %s\n", "-k, --kilobytes");
685 printf (" %s\n", _("Same as '--units kB'"));
686 printf (" %s\n", "-m, --megabytes");
687 printf (" %s\n", _("Same as '--units MB'"));
688 printf (" %s\n", "-l, --local");
689 printf (" %s\n", _("Only check local filesystems"));
690 printf (" %s\n", "-p, --path=PATH, --partition=PARTITION");
691 printf (" %s\n", _("Path or partition (may be repeated)"));
692 printf (" %s\n", "-x, --exclude_device=PATH <STRING>");
693 printf (" %s\n", _("Ignore device (only works if -p unspecified)"));
694 printf (" %s\n", _("-X, --exclude-type=TYPE <STRING>"));
695 printf (" %s\n", _("Ignore all filesystems of indicated type (may be repeated)"));
696 printf (" %s\n", "-m, --mountpoint");
697 printf (" %s\n", _("Display the mountpoint instead of the partition"));
698 printf (" %s\n", "-e, --errors-only");
699 printf (" %s\n", _("Display only devices/mountpoints with errors"));
700 printf (_(UT_TIMEOUT), DEFAULT_SOCKET_TIMEOUT);
701 printf (_(UT_VERBOSE));
702 printf ("\n");
703 printf ("%s\n", _("Examples:"));
704 printf (" %s\n", "check_disk -w 10% -c 5% -p /tmp -p /var -C -w 100000 -c 50000 -p /");
705 printf (" %s\n", _("Checks /tmp and /var at 10% and 5%, and / at 100MB and 50MB"));
706 printf (_(UT_SUPPORT));
707 }
711 void
712 print_usage (void)
713 {
714 printf (_("Usage:"));
715 printf (" %s -w limit -c limit [-p path | -x device] [-t timeout]", progname);
716 printf ("[-m] [-e] [-W limit] [-K limit] [-v] [-q]\n");
717 }