summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--plugins/check_disk.c85
1 files changed, 43 insertions, 42 deletions
diff --git a/plugins/check_disk.c b/plugins/check_disk.c
index 03f09494..9e1ba0db 100644
--- a/plugins/check_disk.c
+++ b/plugins/check_disk.c
@@ -319,8 +319,8 @@ main (int argc, char **argv)
319 dfree_inodes_percent = 100 - dused_inodes_percent; 319 dfree_inodes_percent = 100 - dused_inodes_percent;
320 320
321 if (verbose >= 3) { 321 if (verbose >= 3) {
322 printf ("For %s, used_pct=%g free_pct=%g used_units=%g free_units=%g total_units=%g used_inodes_pct=%g free_inodes_pct=%g\n", 322 printf ("For %s, used_pct=%g free_pct=%g used_units=%g free_units=%g total_units=%g used_inodes_pct=%g free_inodes_pct=%g fsp.fsu_blocksize=%lu mult=%lu\n",
323 me->me_mountdir, dused_pct, dfree_pct, dused_units, dfree_units, dtotal_units, dused_inodes_percent, dfree_inodes_percent); 323 me->me_mountdir, dused_pct, dfree_pct, dused_units, dfree_units, dtotal_units, dused_inodes_percent, dfree_inodes_percent, fsp.fsu_blocksize, mult);
324 } 324 }
325 325
326 /* Threshold comparisons */ 326 /* Threshold comparisons */
@@ -373,6 +373,7 @@ main (int argc, char **argv)
373 critical_high_tide = abs( min( (double) critical_high_tide, (double) (1.0 - path->freespace_percent->critical->end/100)*dtotal_units )); 373 critical_high_tide = abs( min( (double) critical_high_tide, (double) (1.0 - path->freespace_percent->critical->end/100)*dtotal_units ));
374 } 374 }
375 375
376 /* Nb: *_high_tide are unset when == UINT_MAX */
376 asprintf (&perf, "%s %s", perf, 377 asprintf (&perf, "%s %s", perf,
377 perfdata ((!strcmp(me->me_mountdir, "none") || display_mntp) ? me->me_devname : me->me_mountdir, 378 perfdata ((!strcmp(me->me_mountdir, "none") || display_mntp) ? me->me_devname : me->me_mountdir,
378 dused_units, units, 379 dused_units, units,
@@ -384,18 +385,16 @@ main (int argc, char **argv)
384 if (disk_result==STATE_OK && erronly && !verbose) 385 if (disk_result==STATE_OK && erronly && !verbose)
385 continue; 386 continue;
386 387
387 if (disk_result!=STATE_OK || verbose>=0) { 388 asprintf (&output, "%s %s %.0f %s (%.0f%%",
388 asprintf (&output, "%s %s %.0f %s (%.0f%%", 389 output,
389 output, 390 (!strcmp(me->me_mountdir, "none") || display_mntp) ? me->me_devname : me->me_mountdir,
390 (!strcmp(me->me_mountdir, "none") || display_mntp) ? me->me_devname : me->me_mountdir, 391 dfree_units,
391 dfree_units, 392 units,
392 units, 393 dfree_pct);
393 dfree_pct); 394 if (dused_inodes_percent < 0) {
394 if (dused_inodes_percent < 0) { 395 asprintf(&output, "%s inode=-);", output);
395 asprintf(&output, "%s inode=-);", output); 396 } else {
396 } else { 397 asprintf(&output, "%s inode=%.0f%%);", output, dfree_inodes_percent );
397 asprintf(&output, "%s inode=%.0f%%);", output, dfree_inodes_percent );
398 }
399 } 398 }
400 399
401 /* TODO: Need to do a similar debug line 400 /* TODO: Need to do a similar debug line
@@ -637,8 +636,9 @@ process_arguments (int argc, char **argv)
637 case 'v': /* verbose */ 636 case 'v': /* verbose */
638 verbose++; 637 verbose++;
639 break; 638 break;
640 case 'q': /* verbose */ 639 case 'q': /* TODO: this function should eventually go away (removed 2007-09-20) */
641 verbose--; 640 /* verbose--; **replaced by line below**. -q was only a broken way of implementing -e */
641 erronly = TRUE;
642 break; 642 break;
643 case 'e': 643 case 'e':
644 erronly = TRUE; 644 erronly = TRUE;
@@ -843,44 +843,44 @@ print_help (void)
843 printf (" %s\n", _("Exit with WARNING status if less than INTEGER units of disk are free")); 843 printf (" %s\n", _("Exit with WARNING status if less than INTEGER units of disk are free"));
844 printf (" %s\n", "-w, --warning=PERCENT%"); 844 printf (" %s\n", "-w, --warning=PERCENT%");
845 printf (" %s\n", _("Exit with WARNING status if less than PERCENT of disk space is free")); 845 printf (" %s\n", _("Exit with WARNING status if less than PERCENT of disk space is free"));
846 printf (" %s\n", "-W, --iwarning=PERCENT%");
847 printf (" %s\n", _("Exit with WARNING status if less than PERCENT of inode space is free"));
848 printf (" %s\n", "-K, --icritical=PERCENT%");
849 printf (" %s\n", _("Exit with CRITICAL status if less than PERCENT of inode space is free"));
850 printf (" %s\n", "-c, --critical=INTEGER"); 846 printf (" %s\n", "-c, --critical=INTEGER");
851 printf (" %s\n", _("Exit with CRITICAL status if less than INTEGER units of disk are free")); 847 printf (" %s\n", _("Exit with CRITICAL status if less than INTEGER units of disk are free"));
852 printf (" %s\n", "-c, --critical=PERCENT%"); 848 printf (" %s\n", "-c, --critical=PERCENT%");
853 printf (" %s\n", _("Exit with CRITCAL status if less than PERCENT of disk space is free")); 849 printf (" %s\n", _("Exit with CRITCAL status if less than PERCENT of disk space is free"));
854 printf (" %s\n", "-C, --clear"); 850 printf (" %s\n", "-W, --iwarning=PERCENT%");
855 printf (" %s\n", _("Clear thresholds")); 851 printf (" %s\n", _("Exit with WARNING status if less than PERCENT of inode space is free"));
856 printf (" %s\n", "-u, --units=STRING"); 852 printf (" %s\n", "-K, --icritical=PERCENT%");
857 printf (" %s\n", _("Choose bytes, kB, MB, GB, TB (default: MB)")); 853 printf (" %s\n", _("Exit with CRITICAL status if less than PERCENT of inode space is free"));
858 printf (" %s\n", "-k, --kilobytes");
859 printf (" %s\n", _("Same as '--units kB'"));
860 printf (" %s\n", "-m, --megabytes");
861 printf (" %s\n", _("Same as '--units MB'"));
862 printf (" %s\n", "-l, --local");
863 printf (" %s\n", _("Only check local filesystems"));
864 printf (" %s\n", "-p, --path=PATH, --partition=PARTITION"); 854 printf (" %s\n", "-p, --path=PATH, --partition=PARTITION");
865 printf (" %s\n", _("Path or partition (may be repeated)")); 855 printf (" %s\n", _("Path or partition (may be repeated)"));
866 printf (" %s\n", "-r, --ereg-path=PATH, --ereg-partition=PARTITION");
867 printf (" %s\n", _("Regular expression for path or partition (may be repeated)"));
868 printf (" %s\n", "-R, --eregi-path=PATH, --eregi-partition=PARTITION");
869 printf (" %s\n", _("Case insensitive regular expression for path/partition (may be repeated)"));
870 printf (" %s\n", "-g, --group=NAME");
871 printf (" %s\n", _("Group pathes. Thresholds apply to (free-)space of all partitions together"));
872 printf (" %s\n", "-x, --exclude_device=PATH <STRING>"); 856 printf (" %s\n", "-x, --exclude_device=PATH <STRING>");
873 printf (" %s\n", _("Ignore device (only works if -p unspecified)")); 857 printf (" %s\n", _("Ignore device (only works if -p unspecified)"));
874 printf (" %s\n", "-X, --exclude-type=TYPE <STRING>"); 858 printf (" %s\n", "-C, --clear");
875 printf (" %s\n", _("Ignore all filesystems of indicated type (may be repeated)")); 859 printf (" %s\n", _("Clear thresholds"));
876 printf (" %s\n", "-M, --mountpoint");
877 printf (" %s\n", _("Display the mountpoint instead of the partition"));
878 printf (" %s\n", "-E, --exact-match"); 860 printf (" %s\n", "-E, --exact-match");
879 printf (" %s\n", _("For paths or partitions specified with -p, only check for exact paths")); 861 printf (" %s\n", _("For paths or partitions specified with -p, only check for exact paths"));
880 printf (" %s\n", "-e, --errors-only"); 862 printf (" %s\n", "-e, --errors-only");
881 printf (" %s\n", _("Display only devices/mountpoints with errors")); 863 printf (" %s\n", _("Display only devices/mountpoints with errors"));
864 printf (" %s\n", "-g, --group=NAME");
865 printf (" %s\n", _("Group pathes. Thresholds apply to (free-)space of all partitions together"));
866 printf (" %s\n", "-k, --kilobytes");
867 printf (" %s\n", _("Same as '--units kB'"));
868 printf (" %s\n", "-l, --local");
869 printf (" %s\n", _("Only check local filesystems"));
870 printf (" %s\n", "-M, --mountpoint");
871 printf (" %s\n", _("Display the mountpoint instead of the partition"));
872 printf (" %s\n", "-m, --megabytes");
873 printf (" %s\n", _("Same as '--units MB'"));
874 printf (" %s\n", "-R, --eregi-path=PATH, --eregi-partition=PARTITION");
875 printf (" %s\n", _("Case insensitive regular expression for path/partition (may be repeated)"));
876 printf (" %s\n", "-r, --ereg-path=PATH, --ereg-partition=PARTITION");
877 printf (" %s\n", _("Regular expression for path or partition (may be repeated)"));
882 printf (_(UT_TIMEOUT), DEFAULT_SOCKET_TIMEOUT); 878 printf (_(UT_TIMEOUT), DEFAULT_SOCKET_TIMEOUT);
879 printf (" %s\n", "-u, --units=STRING");
880 printf (" %s\n", _("Choose bytes, kB, MB, GB, TB (default: MB)"));
883 printf (_(UT_VERBOSE)); 881 printf (_(UT_VERBOSE));
882 printf (" %s\n", "-X, --exclude-type=TYPE");
883 printf (" %s\n", _("Ignore all filesystems of indicated type (may be repeated)"));
884 printf ("\n"); 884 printf ("\n");
885 printf ("%s\n", _("Examples:")); 885 printf ("%s\n", _("Examples:"));
886 printf (" %s\n", "check_disk -w 10% -c 5% -p /tmp -p /var -C -w 100000 -c 50000 -p /"); 886 printf (" %s\n", "check_disk -w 10% -c 5% -p /tmp -p /var -C -w 100000 -c 50000 -p /");
@@ -899,6 +899,7 @@ void
899print_usage (void) 899print_usage (void)
900{ 900{
901 printf (_("Usage:")); 901 printf (_("Usage:"));
902 printf (" %s -w limit -c limit [-p path | -x device] [-t timeout]", progname); 902 printf (" %s -w limit -c limit [-W limit] [-K limit] {-p path | -x device}\n", progname);
903 printf ("[-m] [-e] [-W limit] [-K limit] [-v] [-q] [-E]\n"); 903 printf ("[-C] [-E] [-e] [-g group ] [-k] [-l] [-M] [-m] [-R path ] [-r path ]\n");
904 printf ("[-t timeout] [-u unit] [-v] [-X type]\n");
904} 905}