diff options
-rw-r--r-- | lib/utils_disk.h | 2 | ||||
-rw-r--r-- | plugins/check_disk.c | 24 |
2 files changed, 12 insertions, 14 deletions
diff --git a/lib/utils_disk.h b/lib/utils_disk.h index 999270c..bf52e4c 100644 --- a/lib/utils_disk.h +++ b/lib/utils_disk.h | |||
@@ -27,7 +27,7 @@ struct parameter_list | |||
27 | uintmax_t total, available, available_to_root, used, | 27 | uintmax_t total, available, available_to_root, used, |
28 | inodes_free, inodes_free_to_root, inodes_used, inodes_total; | 28 | inodes_free, inodes_free_to_root, inodes_used, inodes_total; |
29 | double dfree_pct, dused_pct; | 29 | double dfree_pct, dused_pct; |
30 | double dused_units, dfree_units, dtotal_units; | 30 | uint64_t dused_units, dfree_units, dtotal_units; |
31 | double dused_inodes_percent, dfree_inodes_percent; | 31 | double dused_inodes_percent, dfree_inodes_percent; |
32 | }; | 32 | }; |
33 | 33 | ||
diff --git a/plugins/check_disk.c b/plugins/check_disk.c index 00afcad..ecde4e5 100644 --- a/plugins/check_disk.c +++ b/plugins/check_disk.c | |||
@@ -172,8 +172,6 @@ main (int argc, char **argv) | |||
172 | char *preamble; | 172 | char *preamble; |
173 | char *flag_header; | 173 | char *flag_header; |
174 | double inode_space_pct; | 174 | double inode_space_pct; |
175 | double warning_high_tide; | ||
176 | double critical_high_tide; | ||
177 | int temp_result; | 175 | int temp_result; |
178 | 176 | ||
179 | struct mount_entry *me; | 177 | struct mount_entry *me; |
@@ -335,23 +333,23 @@ main (int argc, char **argv) | |||
335 | */ | 333 | */ |
336 | 334 | ||
337 | /* *_high_tide must be reinitialized at each run */ | 335 | /* *_high_tide must be reinitialized at each run */ |
338 | warning_high_tide = UINT_MAX; | 336 | uint64_t warning_high_tide = UINT64_MAX; |
339 | critical_high_tide = UINT_MAX; | 337 | uint64_t critical_high_tide = UINT64_MAX; |
340 | 338 | ||
341 | if (path->freespace_units->warning != NULL) { | 339 | if (path->freespace_units->warning != NULL) { |
342 | warning_high_tide = path->dtotal_units - path->freespace_units->warning->end; | 340 | warning_high_tide = path->dtotal_units - path->freespace_units->warning->end; |
343 | } | 341 | } |
344 | if (path->freespace_percent->warning != NULL) { | 342 | if (path->freespace_percent->warning != NULL) { |
345 | warning_high_tide = abs( min( (double) warning_high_tide, (double) (1.0 - path->freespace_percent->warning->end/100)*path->dtotal_units )); | 343 | warning_high_tide = llabs( min( (double) warning_high_tide, (1.0 - path->freespace_percent->warning->end / 100 * path->dtotal_units) )); |
346 | } | 344 | } |
347 | if (path->freespace_units->critical != NULL) { | 345 | if (path->freespace_units->critical != NULL) { |
348 | critical_high_tide = path->dtotal_units - path->freespace_units->critical->end; | 346 | critical_high_tide = path->dtotal_units - path->freespace_units->critical->end; |
349 | } | 347 | } |
350 | if (path->freespace_percent->critical != NULL) { | 348 | if (path->freespace_percent->critical != NULL) { |
351 | critical_high_tide = abs( min( (double) critical_high_tide, (double) (1.0 - path->freespace_percent->critical->end/100)*path->dtotal_units )); | 349 | critical_high_tide = llabs( min( (double) critical_high_tide, (double) (1.0 - path->freespace_percent->critical->end/100)*path->dtotal_units )); |
352 | } | 350 | } |
353 | 351 | ||
354 | /* Nb: *_high_tide are unset when == UINT_MAX */ | 352 | /* Nb: *_high_tide are unset when == UINT64_MAX */ |
355 | xasprintf (&perf, "%s %s", perf, | 353 | xasprintf (&perf, "%s %s", perf, |
356 | perfdata_uint64 ( | 354 | perfdata_uint64 ( |
357 | (!strcmp(me->me_mountdir, "none") || display_mntp) ? me->me_devname : me->me_mountdir, | 355 | (!strcmp(me->me_mountdir, "none") || display_mntp) ? me->me_devname : me->me_mountdir, |
@@ -363,18 +361,18 @@ main (int argc, char **argv) | |||
363 | 361 | ||
364 | if (display_inodes_perfdata) { | 362 | if (display_inodes_perfdata) { |
365 | /* *_high_tide must be reinitialized at each run */ | 363 | /* *_high_tide must be reinitialized at each run */ |
366 | warning_high_tide = UINT_MAX; | 364 | warning_high_tide = UINT64_MAX; |
367 | critical_high_tide = UINT_MAX; | 365 | critical_high_tide = UINT64_MAX; |
368 | 366 | ||
369 | if (path->freeinodes_percent->warning != NULL) { | 367 | if (path->freeinodes_percent->warning != NULL) { |
370 | warning_high_tide = abs( min( (double) warning_high_tide, (double) (1.0 - path->freeinodes_percent->warning->end/100)*path->inodes_total )); | 368 | warning_high_tide = llabs( min( (double) warning_high_tide, (double) (1.0 - path->freeinodes_percent->warning->end/100)*path->inodes_total )); |
371 | } | 369 | } |
372 | if (path->freeinodes_percent->critical != NULL) { | 370 | if (path->freeinodes_percent->critical != NULL) { |
373 | critical_high_tide = abs( min( (double) critical_high_tide, (double) (1.0 - path->freeinodes_percent->critical->end/100)*path->inodes_total )); | 371 | critical_high_tide = llabs( min( (double) critical_high_tide, (double) (1.0 - path->freeinodes_percent->critical->end/100)*path->inodes_total )); |
374 | } | 372 | } |
375 | 373 | ||
376 | xasprintf (&perf_ilabel, "%s (inodes)", (!strcmp(me->me_mountdir, "none") || display_mntp) ? me->me_devname : me->me_mountdir); | 374 | xasprintf (&perf_ilabel, "%s (inodes)", (!strcmp(me->me_mountdir, "none") || display_mntp) ? me->me_devname : me->me_mountdir); |
377 | /* Nb: *_high_tide are unset when == UINT_MAX */ | 375 | /* Nb: *_high_tide are unset when == UINT64_MAX */ |
378 | xasprintf (&perf, "%s %s", perf, | 376 | xasprintf (&perf, "%s %s", perf, |
379 | perfdata_uint64 (perf_ilabel, | 377 | perfdata_uint64 (perf_ilabel, |
380 | path->inodes_used, "", | 378 | path->inodes_used, "", |
@@ -392,7 +390,7 @@ main (int argc, char **argv) | |||
392 | } else { | 390 | } else { |
393 | xasprintf(&flag_header, ""); | 391 | xasprintf(&flag_header, ""); |
394 | } | 392 | } |
395 | xasprintf (&output, "%s%s %s %.0f %s (%.0f%%", | 393 | xasprintf (&output, "%s%s %s %llu%s (%.0f%%", |
396 | output, flag_header, | 394 | output, flag_header, |
397 | (!strcmp(me->me_mountdir, "none") || display_mntp) ? me->me_devname : me->me_mountdir, | 395 | (!strcmp(me->me_mountdir, "none") || display_mntp) ? me->me_devname : me->me_mountdir, |
398 | path->dfree_units, | 396 | path->dfree_units, |