Code

Move new util_* functions to lib/
[nagiosplug.git] / plugins / check_disk.c
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 "utils_disk.h"
49 #include <stdarg.h>
50 #include "fsusage.h"
51 #include "mountlist.h"
52 #if HAVE_LIMITS_H
53 # include <limits.h>
54 #endif
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 = NULL;
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
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 void print_help (void);
123 void print_usage (void);
125 uintmax_t w_df = 0;
126 uintmax_t c_df = 0;
127 double w_dfp = -1.0;
128 double c_dfp = -1.0;
129 double w_idfp = -1.0;
130 double c_idfp = -1.0;
131 char *path;
132 char *exclude_device;
133 char *units;
134 uintmax_t mult = 1024 * 1024;
135 int verbose = 0;
136 int erronly = FALSE;
137 int display_mntp = FALSE;
138 int exact_match = FALSE;
141 int
142 main (int argc, char **argv)
144   double usp = -1.0, uisp = -1.0;
145   int result = STATE_UNKNOWN;
146   int disk_result = STATE_UNKNOWN;
147   char file_system[MAX_INPUT_BUFFER];
148   char *output;
149   char *details;
150   char *perf;
151   uintmax_t psize;
152   float free_space, free_space_pct, total_space, inode_space_pct;
154   struct mount_entry *me;
155   struct fs_usage fsp;
156   struct parameter_list *temp_list, *path;
157   struct name_list *seen = NULL;
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 not been selected, find entire
173      mount list and create list of paths
174    */
175   if (! path_select_list) {
176     for (me = mount_list; me; me = me->me_next) {
177       path = np_add_parameter(&path_select_list, me->me_mountdir);
178       path->w_df = w_df;
179       path->c_df = c_df;
180       path->w_dfp = w_dfp;
181       path->c_dfp = c_dfp;
182       path->w_idfp = w_idfp;
183       path->c_idfp = c_idfp;
184       path->best_match = me;
185     }
186   } else {
187     np_set_best_match(path_select_list, mount_list, exact_match);
189     /* Error if no match found for specified paths */
190     temp_list = path_select_list;
191     while (temp_list) {
192       if (! temp_list->best_match) {
193         die (STATE_CRITICAL, _("DISK %s: %s not found\n"), _("CRITICAL"), temp_list->name);
194       }
195       temp_list = temp_list->name_next;
196     }
197   }
199   /* Process for every path in list */
200   for (path = path_select_list; path; path=path->name_next) {
201     me = path->best_match;
202     w_df = path->w_df;
203     c_df = path->c_df;
204     w_dfp = path->w_dfp;
205     c_dfp = path->c_dfp;
206     w_idfp = path->w_idfp;
207     c_idfp = path->c_idfp;
209     /* Filters */
211     /* Remove filesystems already seen */
212     if (np_seen_name(seen, me->me_mountdir)) {
213       continue;
214     } else {
215       np_add_name(&seen, me->me_mountdir);
216     }
217     /* Skip remote filesystems if we're not interested in them */
218     if (me->me_remote && show_local_fs) {
219       continue;
220     /* Skip pseudo fs's if we haven't asked for all fs's */
221     } else if (me->me_dummy && !show_all_fs) {
222       continue;
223     /* Skip excluded fstypes */
224     } else if (fs_exclude_list && np_find_name (fs_exclude_list, me->me_type)) {
225       continue;
226     /* Skip excluded fs's */  
227     } else if (dp_exclude_list && 
228              (np_find_name (dp_exclude_list, me->me_devname) ||
229               np_find_name (dp_exclude_list, me->me_mountdir))) {
230       continue;
231     }
233     get_fs_usage (me->me_mountdir, me->me_devname, &fsp);
235     if (fsp.fsu_blocks && strcmp ("none", me->me_mountdir)) {
236       usp = (double)(fsp.fsu_blocks - fsp.fsu_bavail) * 100 / fsp.fsu_blocks;
237                         uisp = (double)(fsp.fsu_files - fsp.fsu_ffree) * 100 / fsp.fsu_files;
238       disk_result = check_disk (usp, fsp.fsu_bavail, uisp);
241       result = max_state (disk_result, result);
242       psize = fsp.fsu_blocks*fsp.fsu_blocksize/mult;
245                         /* Moved this computation up here so we can add it
246                          * to perf */
247                         inode_space_pct = (float)fsp.fsu_ffree*100/fsp.fsu_files;
250       asprintf (&perf, "%s %s", perf,
251                 perfdata ((!strcmp(file_system, "none") || display_mntp) ? me->me_devname : me->me_mountdir,
252                           psize-(fsp.fsu_bavail*fsp.fsu_blocksize/mult), units,
253                           TRUE, min ((uintmax_t)psize-(uintmax_t)w_df, (uintmax_t)((1.0-w_dfp/100.0)*psize)),
254                           TRUE, min ((uintmax_t)psize-(uintmax_t)c_df, (uintmax_t)((1.0-c_dfp/100.0)*psize)),
255                                             TRUE, inode_space_pct,
257                           TRUE, psize));
258       if (disk_result==STATE_OK && erronly && !verbose)
259         continue;
261       free_space = (float)fsp.fsu_bavail*fsp.fsu_blocksize/mult;
262       free_space_pct = (float)fsp.fsu_bavail*100/fsp.fsu_blocks;
263       total_space = (float)fsp.fsu_blocks*fsp.fsu_blocksize/mult;
264       if (disk_result!=STATE_OK || verbose>=0)
265         asprintf (&output, ("%s %s %.0f %s (%.0f%% inode=%.0f%%);"),
266                   output,
267                   (!strcmp(file_system, "none") || display_mntp) ? me->me_devname : me->me_mountdir,
268                   free_space,
269                   units,
270             free_space_pct,
271             inode_space_pct);
273       asprintf (&details, _("%s\n\
274 %.0f of %.0f %s (%.0f%% inode=%.0f%%) free on %s (type %s mounted on %s) warn:%lu crit:%lu warn%%:%.0f%% crit%%:%.0f%%"),
275                 details, free_space, total_space, units, free_space_pct, inode_space_pct,
276                 me->me_devname, me->me_type, me->me_mountdir,
277                 (unsigned long)w_df, (unsigned long)c_df, w_dfp, c_dfp);
279     }
281   }
283   if (verbose > 2)
284     asprintf (&output, "%s%s", output, details);
287   printf ("DISK %s%s|%s\n", state_text (result), output, perf);
288   return result;
293 /* process command-line arguments */
294 int
295 process_arguments (int argc, char **argv)
297   int c;
298   struct parameter_list *se;
299   struct parameter_list *temp_list;
300   int result = OK;
301   struct stat *stat_buf;
302   char *warn_freespace = NULL;
303   char *crit_freespace = NULL;
304   char *warn_freespace_percent = NULL;
305   char *crit_freespace_percent = NULL;
306   char temp_string[MAX_INPUT_BUFFER];
308   unsigned long l;
309   double f;
311   int option = 0;
312   static struct option longopts[] = {
313     {"timeout", required_argument, 0, 't'},
314     {"warning", required_argument, 0, 'w'},
315     {"critical", required_argument, 0, 'c'},
316     {"iwarning", required_argument, 0, 'W'},
317     /* Dang, -C is taken. We might want to reshuffle this. */
318     {"icritical", required_argument, 0, 'K'},
319     {"local", required_argument, 0, 'l'},
320     {"kilobytes", required_argument, 0, 'k'},
321     {"megabytes", required_argument, 0, 'm'},
322     {"units", required_argument, 0, 'u'},
323     {"path", required_argument, 0, 'p'},
324     {"partition", required_argument, 0, 'p'},
325     {"exclude_device", required_argument, 0, 'x'},
326     {"exclude-type", required_argument, 0, 'X'},
327     {"mountpoint", no_argument, 0, 'M'},
328     {"errors-only", no_argument, 0, 'e'},
329     {"exact-match", no_argument, 0, 'E'},
330     {"verbose", no_argument, 0, 'v'},
331     {"quiet", no_argument, 0, 'q'},
332     {"clear", no_argument, 0, 'C'},
333     {"version", no_argument, 0, 'V'},
334     {"help", no_argument, 0, 'h'},
335     {0, 0, 0, 0}
336   };
338   if (argc < 2)
339     return ERROR;
341   np_add_name(&fs_exclude_list, "iso9660");
343   for (c = 1; c < argc; c++)
344     if (strcmp ("-to", argv[c]) == 0)
345       strcpy (argv[c], "-t");
347   while (1) {
348     c = getopt_long (argc, argv, "+?VqhveCt:c:w:K:W:u:p:x:X:mklME", longopts, &option);
350     if (c == -1 || c == EOF)
351       break;
353     switch (c) {
354     case 't':                 /* timeout period */
355       if (is_integer (optarg)) {
356         timeout_interval = atoi (optarg);
357         break;
358       }
359       else {
360         usage2 (_("Timeout interval must be a positive integer"), optarg);
361       }
362     case 'w':                 /* warning threshold */
363       /*
364       if (strstr(optarg, "%")) {
365         printf("Got percent with optarg=%s\n", optarg);
366         warn_freespace_percent = optarg;
367       } else {
368         warn_freespace = optarg;
369       }
370       break;
371       */
372       if (is_intnonneg (optarg)) {
373         w_df = atoi (optarg);
374         break;
375       }
376       else if (strpbrk (optarg, ",:") &&
377                strstr (optarg, "%") &&
378                sscanf (optarg, "%lu%*[:,]%lf%%", &l, &w_dfp) == 2) {
379         w_df = (uintmax_t)l;
380         break;
381       }
382       else if (strstr (optarg, "%") && sscanf (optarg, "%lf%%", &w_dfp) == 1) {
383         break;
384       }
385       else {
386         usage4 (_("Warning threshold must be integer or percentage!"));
387       }
388     case 'c':                 /* critical threshold */
389       if (is_intnonneg (optarg)) {
390         c_df = atoi (optarg);
391         break;
392       }
393       else if (strpbrk (optarg, ",:") &&
394                strstr (optarg, "%") &&
395                sscanf (optarg, "%lu%*[,:]%lf%%", &l, &c_dfp) == 2) {
396         c_df = (uintmax_t)l;
397         break;
398       }
399       else if (strstr (optarg, "%") && sscanf (optarg, "%lf%%", &c_dfp) == 1) {
400         break;
401       }
402       else {
403         usage4 (_("Critical threshold must be integer or percentage!"));
404       }
407                 case 'W':                                                                       /* warning inode threshold */
408                         if (strstr (optarg, "%") && sscanf (optarg, "%lf%%", &w_idfp) == 1) {
409                         break;
410                         }
411                         else {
412                       usage (_("Warning inode threshold must be percentage!\n"));
413                   }
414                 case 'K':                                                                       /* kritical inode threshold */
415                         if (strstr (optarg, "%") && sscanf (optarg, "%lf%%", &c_idfp) == 1) {
416                         break;
417                         }
418                         else {
419                       usage (_("Critical inode threshold must be percentage!\n"));
420                        }
421     case 'u':
422       if (units)
423         free(units);
424       if (! strcmp (optarg, "bytes")) {
425         mult = (uintmax_t)1;
426         units = strdup ("B");
427       } else if (! strcmp (optarg, "kB")) {
428         mult = (uintmax_t)1024;
429         units = strdup ("kB");
430       } else if (! strcmp (optarg, "MB")) {
431         mult = (uintmax_t)1024 * 1024;
432         units = strdup ("MB");
433       } else if (! strcmp (optarg, "GB")) {
434         mult = (uintmax_t)1024 * 1024 * 1024;
435         units = strdup ("GB");
436       } else if (! strcmp (optarg, "TB")) {
437         mult = (uintmax_t)1024 * 1024 * 1024 * 1024;
438         units = strdup ("TB");
439       } else {
440         die (STATE_UNKNOWN, _("unit type %s not known\n"), optarg);
441       }
442       if (units == NULL)
443         die (STATE_UNKNOWN, _("failed allocating storage for '%s'\n"), "units");
444       break;
445     case 'k': /* display mountpoint */
446       mult = 1024;
447       if (units)
448         free(units);
449       units = strdup ("kB");
450       break;
451     case 'm': /* display mountpoint */
452       mult = 1024 * 1024;
453       if (units)
454         free(units);
455       units = strdup ("MB");
456       break;
457     case 'l':
458       show_local_fs = 1;      
459       break;
460     case 'p':                 /* select path */
461       se = np_add_parameter(&path_select_list, optarg);
462       se->w_df = w_df;
463       se->c_df = c_df;
464       se->w_dfp = w_dfp;
465       se->c_dfp = c_dfp;
466       se->w_idfp = w_idfp;
467       se->c_idfp = c_idfp;
468       break;
469     case 'x':                 /* exclude path or partition */
470       np_add_name(&dp_exclude_list, optarg);
471       break;
472     case 'X':                 /* exclude file system type */
473       np_add_name(&fs_exclude_list, optarg);
474       break;
475     case 'v':                 /* verbose */
476       verbose++;
477       break;
478     case 'q':                 /* verbose */
479       verbose--;
480       break;
481     case 'e':
482       erronly = TRUE;
483       break;
484     case 'E':
485       exact_match = 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 = np_add_parameter(&path_select_list, strdup(argv[c++]));
519     se->w_df = w_df;
520     se->c_df = c_df;
521     se->w_dfp = w_dfp;
522     se->c_dfp = c_dfp;
523     se->w_idfp = w_idfp;
524     se->c_idfp = c_idfp;
525   }
527   if (path_select_list) {
528     temp_list = path_select_list;
529     stat_buf = malloc(sizeof *stat_buf);
530     while (temp_list) {
531       /* Stat each entry to check that dir exists */
532       if (stat (temp_list->name, &stat_buf[0])) {
533         printf("DISK %s - ", _("CRITICAL"));
534         die (STATE_CRITICAL, _("%s does not exist\n"), temp_list->name);
535       }
536       if (validate_arguments (temp_list->w_df,
537                               temp_list->c_df,
538                               temp_list->w_dfp,
539                               temp_list->c_dfp,
540                               temp_list->w_idfp,
541                               temp_list->c_idfp,
542                               temp_list->name) == ERROR)
543         result = ERROR;
544       temp_list = temp_list->name_next;
545     }
546     free(stat_buf);
547     return result;
548   } else {
549     return validate_arguments (w_df, c_df, w_dfp, c_dfp, w_idfp, c_idfp, NULL);
550   }
555 void
556 print_path (const char *mypath) 
558   if (mypath == NULL)
559     printf ("\n");
560   else
561     printf (_(" for %s\n"), mypath);
563   return;
568 int
569 validate_arguments (uintmax_t w, uintmax_t c, double wp, double cp, double iwp, double icp, char *mypath)
571   if (w < 0 && c < 0 && wp < 0.0 && cp < 0.0) {
572     printf (_("INPUT ERROR: No thresholds specified"));
573     print_path (mypath);
574     return ERROR;
575   }
576   else if ((wp >= 0.0 || cp >= 0.0) &&
577            (wp < 0.0 || cp < 0.0 || wp > 100.0 || cp > 100.0 || cp > wp)) {
578     printf (_("\
579 INPUT ERROR: C_DFP (%f) should be less than W_DFP (%.1f) and both should be between zero and 100 percent, inclusive"),
580             cp, wp);
581     print_path (mypath);
582     return ERROR;
583   }
584   else if ((iwp >= 0.0 || icp >= 0.0) &&
585            (iwp < 0.0 || icp < 0.0 || iwp > 100.0 || icp > 100.0 || icp > iwp)) {
586     printf (_("\
587 INPUT ERROR: C_IDFP (%f) should be less than W_IDFP (%.1f) and both should be between zero and 100 percent, inclusive"),
588             icp, iwp);
589     print_path (mypath);
590     return ERROR;
591   }
592   else if ((w > 0 || c > 0) && (w == 0 || c == 0 || c > w)) {
593     printf (_("\
594 INPUT ERROR: C_DF (%lu) should be less than W_DF (%lu) and both should be greater than zero"),
595             (unsigned long)c, (unsigned long)w);
596     print_path (mypath);
597     return ERROR;
598   }
599   
600   if (units == NULL) {
601     units = strdup ("MB");
602     mult = (uintmax_t)1024 * 1024;
603   }
604   return OK;
609 int
610 check_disk (double usp, uintmax_t free_disk, double uisp)
612        int result = STATE_UNKNOWN;
613        /* check the percent used space against thresholds */
614        if (usp >= 0.0 && c_dfp >=0.0 && usp >= (100.0 - c_dfp))
615                result = STATE_CRITICAL;
616        else if (uisp >= 0.0 && c_idfp >=0.0 && uisp >= (100.0 - c_idfp))
617                result = STATE_CRITICAL;
618        else if (c_df > 0 && free_disk <= c_df)
619                result = STATE_CRITICAL;
620        else if (usp >= 0.0 && w_dfp >=0.0 && usp >= (100.0 - w_dfp))
621                result = STATE_WARNING;
622        else if (uisp >= 0.0 && w_idfp >=0.0 && uisp >= (100.0 - w_idfp))
623                result = STATE_WARNING;
624        else if (w_df > 0 && free_disk <= w_df)
625                result = STATE_WARNING;
626        else if (usp >= 0.0)
627     result = STATE_OK;
628   return result;
636 void
637 print_help (void)
639   print_revision (progname, revision);
641   printf ("Copyright (c) 1999 Ethan Galstad <nagios@nagios.org>\n");
642   printf (COPYRIGHT, copyright, email);
644   printf ("%s\n", _("This plugin checks the amount of used disk space on a mounted file system"));
645   printf ("%s\n", _("and generates an alert if free space is less than one of the threshold values"));
647   printf ("\n\n");
649   print_usage ();
651   printf (_(UT_HELP_VRSN));
653   printf (" %s\n", "-w, --warning=INTEGER");
654   printf ("    %s\n", _("Exit with WARNING status if less than INTEGER units of disk are free"));
655   printf (" %s\n", "-w, --warning=PERCENT%");
656   printf ("    %s\n", _("Exit with WARNING status if less than PERCENT of disk space is free"));
657   printf (" %s\n", "-W, --iwarning=PERCENT%");
658   printf ("    %s\n", _("Exit with WARNING status if less than PERCENT of inode space is free"));
659   printf (" %s\n", "-K, --icritical=PERCENT%");
660   printf ("    %s\n", _("Exit with CRITICAL status if less than PERCENT of inode space is free"));
661   printf (" %s\n", "-c, --critical=INTEGER");
662   printf ("    %s\n", _("Exit with CRITICAL status if less than INTEGER units of disk are free"));
663   printf (" %s\n", "-c, --critical=PERCENT%");
664   printf ("    %s\n", _("Exit with CRITCAL status if less than PERCENT of disk space is free"));
665   printf (" %s\n", "-C, --clear");
666   printf ("    %s\n", _("Clear thresholds"));
667   printf (" %s\n", "-u, --units=STRING");
668   printf ("    %s\n", _("Choose bytes, kB, MB, GB, TB (default: MB)"));
669   printf (" %s\n", "-k, --kilobytes");
670   printf ("    %s\n", _("Same as '--units kB'"));
671   printf (" %s\n", "-m, --megabytes");
672   printf ("    %s\n", _("Same as '--units MB'"));
673   printf (" %s\n", "-l, --local");
674   printf ("    %s\n", _("Only check local filesystems"));
675   printf (" %s\n", "-p, --path=PATH, --partition=PARTITION");
676   printf ("    %s\n", _("Path or partition (may be repeated)"));
677   printf (" %s\n", "-x, --exclude_device=PATH <STRING>");
678   printf ("    %s\n", _("Ignore device (only works if -p unspecified)"));
679   printf (" %s\n", _("-X, --exclude-type=TYPE <STRING>"));
680   printf ("    %s\n", _("Ignore all filesystems of indicated type (may be repeated)"));
681   printf (" %s\n", "-m, --mountpoint");
682   printf ("    %s\n", _("Display the mountpoint instead of the partition"));
683   printf (" %s\n", "-E, --exact-match");
684   printf ("    %s\n", _("For paths or partitions specified with -p, only check for exact paths"));
685   printf (" %s\n", "-e, --errors-only");
686   printf ("    %s\n", _("Display only devices/mountpoints with errors"));
687   printf (_(UT_TIMEOUT), DEFAULT_SOCKET_TIMEOUT);
688   printf (_(UT_VERBOSE));
689   printf ("\n");
690   printf ("%s\n", _("Examples:"));
691   printf (" %s\n", "check_disk -w 10% -c 5% -p /tmp -p /var -C -w 100000 -c 50000 -p /");
692   printf ("    %s\n", _("Checks /tmp and /var at 10% and 5%, and / at 100MB and 50MB"));
693   printf (_(UT_SUPPORT));
698 void
699 print_usage (void)
701   printf (_("Usage:"));
702   printf (" %s -w limit -c limit [-p path | -x device] [-t timeout]", progname);
703   printf ("[-m] [-e] [-W limit] [-K limit] [-v] [-q] [-E]\n");