aboutsummaryrefslogtreecommitdiff
path: root/plugins/check_disk.c
diff options
context:
space:
mode:
authorGravatar Thomas Guyot-Sionnest <dermoth@users.sourceforge.net> 2007-12-08 16:34:05 +0000
committerGravatar Thomas Guyot-Sionnest <dermoth@users.sourceforge.net> 2007-12-08 16:34:05 +0000
commitdbc22e1acd813433c44dd5e1c0a20f04793f0603 (patch)
tree84559d2fb1499d6e94d8b49aae626671dad96b5a /plugins/check_disk.c
parentee748cd343bdb74a2073e512189942d71ba4200d (diff)
downloadmonitoring-plugins-dbc22e1acd813433c44dd5e1c0a20f04793f0603.tar.gz
Fix check_disk reporting OK if disk usage grows over 100% (bug #1348746).
git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@1848 f882894a-f735-0410-b71e-b25c423dba1c
Diffstat (limited to 'plugins/check_disk.c')
-rw-r--r--plugins/check_disk.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/plugins/check_disk.c b/plugins/check_disk.c
index 4c6886e4..b8bbdbda 100644
--- a/plugins/check_disk.c
+++ b/plugins/check_disk.c
@@ -307,10 +307,17 @@ main (int argc, char **argv)
if (fsp.fsu_blocks && strcmp ("none", me->me_mountdir)) {
total = fsp.fsu_blocks;
- available = fsp.fsu_bavail;
+ /* 2007-12-08 - Workaround for Gnulib reporting insanely high available
+ * space on BSD (the actual value should be negative but fsp.fsu_bavail
+ * is unsigned) */
+ available = fsp.fsu_bavail > fsp.fsu_bfree ? 0 : fsp.fsu_bavail;
available_to_root = fsp.fsu_bfree;
used = total - available_to_root;
+ if (verbose >= 3)
+ printf ("For %s, total=%llu, available=%llu, available_to_root=%llu, used=%llu, fsp.fsu_files=%llu, fsp.fsu_ffree=%llu\n",
+ me->me_mountdir, total, available, available_to_root, used, fsp.fsu_files, fsp.fsu_ffree);
+
dused_pct = calculate_percent( used, used + available ); /* used + available can never be > uintmax */
dfree_pct = 100 - dused_pct;