diff options
author | Ton Voon <tonvoon@users.sourceforge.net> | 2006-08-14 09:04:16 +0000 |
---|---|---|
committer | Ton Voon <tonvoon@users.sourceforge.net> | 2006-08-14 09:04:16 +0000 |
commit | 17127bb541a88aa77d278a88a97672961c92c0f5 (patch) | |
tree | 38a88d19f2cff9325654f3d5ba267e208b67bfb6 | |
parent | 4bb5d88b24f511007d6721a178148c88f9828cce (diff) | |
download | monitoring-plugins-17127bb541a88aa77d278a88a97672961c92c0f5.tar.gz |
Fixed inode percent free output (Mike Emigh - 1531899)
git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@1469 f882894a-f735-0410-b71e-b25c423dba1c
-rw-r--r-- | THANKS.in | 2 | ||||
-rw-r--r-- | plugins/check_disk.c | 14 |
2 files changed, 5 insertions, 11 deletions
@@ -188,3 +188,5 @@ Cire Iriarte | |||
188 | Allan Bennett | 188 | Allan Bennett |
189 | Ari Pollak | 189 | Ari Pollak |
190 | Lance Albertson | 190 | Lance Albertson |
191 | Nathan Vonnahme | ||
192 | Mike Emigh | ||
diff --git a/plugins/check_disk.c b/plugins/check_disk.c index e7a3b216..b546fd2f 100644 --- a/plugins/check_disk.c +++ b/plugins/check_disk.c | |||
@@ -157,7 +157,7 @@ main (int argc, char **argv) | |||
157 | uintmax_t total, available, available_to_root, used; | 157 | uintmax_t total, available, available_to_root, used; |
158 | double dfree_pct = -1, dused_pct = -1; | 158 | double dfree_pct = -1, dused_pct = -1; |
159 | double dused_units, dfree_units, dtotal_units; | 159 | double dused_units, dfree_units, dtotal_units; |
160 | double dused_inodes_percent; | 160 | double dused_inodes_percent, dfree_inodes_percent; |
161 | int temp_result; | 161 | int temp_result; |
162 | 162 | ||
163 | struct mount_entry *me; | 163 | struct mount_entry *me; |
@@ -247,6 +247,7 @@ main (int argc, char **argv) | |||
247 | dfree_units = available*fsp.fsu_blocksize/mult; | 247 | dfree_units = available*fsp.fsu_blocksize/mult; |
248 | dtotal_units = total*fsp.fsu_blocksize/mult; | 248 | dtotal_units = total*fsp.fsu_blocksize/mult; |
249 | dused_inodes_percent = calculate_percent(fsp.fsu_files - fsp.fsu_ffree, fsp.fsu_files); | 249 | dused_inodes_percent = calculate_percent(fsp.fsu_files - fsp.fsu_ffree, fsp.fsu_files); |
250 | dfree_inodes_percent = 100 - dused_inodes_percent; | ||
250 | 251 | ||
251 | if (verbose >= 3) { | 252 | if (verbose >= 3) { |
252 | printf ("For %s, used_pct=%g free_pct=%g used_units=%g free_units=%g total_units=%g used_inodes_pct=%g\n", | 253 | printf ("For %s, used_pct=%g free_pct=%g used_units=%g free_units=%g total_units=%g used_inodes_pct=%g\n", |
@@ -275,15 +276,6 @@ main (int argc, char **argv) | |||
275 | if (verbose >=3) printf("Usedinodes_percent result=%d\n", temp_result); | 276 | if (verbose >=3) printf("Usedinodes_percent result=%d\n", temp_result); |
276 | result = max_state( result, temp_result ); | 277 | result = max_state( result, temp_result ); |
277 | 278 | ||
278 | |||
279 | |||
280 | |||
281 | |||
282 | /* Moved this computation up here so we can add it | ||
283 | * to perf */ | ||
284 | inode_space_pct = (1 - dused_inodes_percent) * 100; | ||
285 | |||
286 | |||
287 | asprintf (&perf, "%s %s", perf, | 279 | asprintf (&perf, "%s %s", perf, |
288 | perfdata ((!strcmp(me->me_mountdir, "none") || display_mntp) ? me->me_devname : me->me_mountdir, | 280 | perfdata ((!strcmp(me->me_mountdir, "none") || display_mntp) ? me->me_devname : me->me_mountdir, |
289 | dused_units, units, | 281 | dused_units, units, |
@@ -305,7 +297,7 @@ main (int argc, char **argv) | |||
305 | if (dused_inodes_percent < 0) { | 297 | if (dused_inodes_percent < 0) { |
306 | asprintf(&output, "%s inode=-);", output); | 298 | asprintf(&output, "%s inode=-);", output); |
307 | } else { | 299 | } else { |
308 | asprintf(&output, "%s inode=%.0f%%);", output, (1 - dused_inodes_percent) * 100); | 300 | asprintf(&output, "%s inode=%.0f%%);", output, dfree_inodes_percent ); |
309 | } | 301 | } |
310 | } | 302 | } |
311 | 303 | ||