diff options
| author | Thomas Guyot-Sionnest <dermoth@users.sourceforge.net> | 2007-12-08 16:34:05 +0000 |
|---|---|---|
| committer | Thomas Guyot-Sionnest <dermoth@users.sourceforge.net> | 2007-12-08 16:34:05 +0000 |
| commit | dbc22e1acd813433c44dd5e1c0a20f04793f0603 (patch) | |
| tree | 84559d2fb1499d6e94d8b49aae626671dad96b5a | |
| parent | ee748cd343bdb74a2073e512189942d71ba4200d (diff) | |
| download | monitoring-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
| -rw-r--r-- | NEWS | 2 | ||||
| -rw-r--r-- | plugins/check_disk.c | 9 |
2 files changed, 10 insertions, 1 deletions
| @@ -13,6 +13,8 @@ This file documents the major additions and syntax changes between releases. | |||
| 13 | Merge two new checks that deprecates check_ntp: check_ntp_peer and check_ntp_time. | 13 | Merge two new checks that deprecates check_ntp: check_ntp_peer and check_ntp_time. |
| 14 | You should read the --help output so see which one is suitable for you. check_ntp_peer | 14 | You should read the --help output so see which one is suitable for you. check_ntp_peer |
| 15 | implement stratum thresholds support (feature request #1703823). | 15 | implement stratum thresholds support (feature request #1703823). |
| 16 | Fix check_disk reporting OK if disk usage grows over 100% (bug #1348746). | ||
| 17 | The problem happens to be in Gnulib but a workaround have been implemented in check_disk.c | ||
| 16 | 18 | ||
| 17 | 1.4.10 28th September 2007 | 19 | 1.4.10 28th September 2007 |
| 18 | Fix check_http buffer overflow vulnerability when following HTTP redirects | 20 | Fix check_http buffer overflow vulnerability when following HTTP redirects |
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) | |||
| 307 | 307 | ||
| 308 | if (fsp.fsu_blocks && strcmp ("none", me->me_mountdir)) { | 308 | if (fsp.fsu_blocks && strcmp ("none", me->me_mountdir)) { |
| 309 | total = fsp.fsu_blocks; | 309 | total = fsp.fsu_blocks; |
| 310 | available = fsp.fsu_bavail; | 310 | /* 2007-12-08 - Workaround for Gnulib reporting insanely high available |
| 311 | * space on BSD (the actual value should be negative but fsp.fsu_bavail | ||
| 312 | * is unsigned) */ | ||
| 313 | available = fsp.fsu_bavail > fsp.fsu_bfree ? 0 : fsp.fsu_bavail; | ||
| 311 | available_to_root = fsp.fsu_bfree; | 314 | available_to_root = fsp.fsu_bfree; |
| 312 | used = total - available_to_root; | 315 | used = total - available_to_root; |
| 313 | 316 | ||
| 317 | if (verbose >= 3) | ||
| 318 | printf ("For %s, total=%llu, available=%llu, available_to_root=%llu, used=%llu, fsp.fsu_files=%llu, fsp.fsu_ffree=%llu\n", | ||
| 319 | me->me_mountdir, total, available, available_to_root, used, fsp.fsu_files, fsp.fsu_ffree); | ||
| 320 | |||
| 314 | dused_pct = calculate_percent( used, used + available ); /* used + available can never be > uintmax */ | 321 | dused_pct = calculate_percent( used, used + available ); /* used + available can never be > uintmax */ |
| 315 | 322 | ||
| 316 | dfree_pct = 100 - dused_pct; | 323 | dfree_pct = 100 - dused_pct; |
