diff options
author | Ton Voon <tonvoon@users.sourceforge.net> | 2006-12-20 19:25:59 +0000 |
---|---|---|
committer | Ton Voon <tonvoon@users.sourceforge.net> | 2006-12-20 19:25:59 +0000 |
commit | 958162b45fb77dcacb302e6c65cc5fb45df47692 (patch) | |
tree | c1f1a55635db7bf38d071f6acbb1a5ad2060b084 /plugins/check_disk.c | |
parent | ff2e8114a43f506133755c1f8222b47601b709e3 (diff) | |
download | monitoring-plugins-958162b45fb77dcacb302e6c65cc5fb45df47692.tar.gz |
Fixed inode thresholds, regressed from previous release
git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@1554 f882894a-f735-0410-b71e-b25c423dba1c
Diffstat (limited to 'plugins/check_disk.c')
-rw-r--r-- | plugins/check_disk.c | 33 |
1 files changed, 26 insertions, 7 deletions
diff --git a/plugins/check_disk.c b/plugins/check_disk.c index 51e8e850..ac86f4d2 100644 --- a/plugins/check_disk.c +++ b/plugins/check_disk.c | |||
@@ -146,6 +146,8 @@ char *warn_usedspace_percent = NULL; | |||
146 | char *crit_usedspace_percent = NULL; | 146 | char *crit_usedspace_percent = NULL; |
147 | char *warn_usedinodes_percent = NULL; | 147 | char *warn_usedinodes_percent = NULL; |
148 | char *crit_usedinodes_percent = NULL; | 148 | char *crit_usedinodes_percent = NULL; |
149 | char *warn_freeinodes_percent = NULL; | ||
150 | char *crit_freeinodes_percent = NULL; | ||
149 | 151 | ||
150 | 152 | ||
151 | int | 153 | int |
@@ -197,6 +199,7 @@ main (int argc, char **argv) | |||
197 | set_thresholds(&path->usedspace_units, warn_usedspace_units, crit_usedspace_units); | 199 | set_thresholds(&path->usedspace_units, warn_usedspace_units, crit_usedspace_units); |
198 | set_thresholds(&path->usedspace_percent, warn_usedspace_percent, crit_usedspace_percent); | 200 | set_thresholds(&path->usedspace_percent, warn_usedspace_percent, crit_usedspace_percent); |
199 | set_thresholds(&path->usedinodes_percent, warn_usedinodes_percent, crit_usedinodes_percent); | 201 | set_thresholds(&path->usedinodes_percent, warn_usedinodes_percent, crit_usedinodes_percent); |
202 | set_thresholds(&path->freeinodes_percent, warn_freeinodes_percent, crit_freeinodes_percent); | ||
200 | } | 203 | } |
201 | } else { | 204 | } else { |
202 | np_set_best_match(path_select_list, mount_list, exact_match); | 205 | np_set_best_match(path_select_list, mount_list, exact_match); |
@@ -261,8 +264,8 @@ main (int argc, char **argv) | |||
261 | dfree_inodes_percent = 100 - dused_inodes_percent; | 264 | dfree_inodes_percent = 100 - dused_inodes_percent; |
262 | 265 | ||
263 | if (verbose >= 3) { | 266 | if (verbose >= 3) { |
264 | printf ("For %s, used_pct=%g free_pct=%g used_units=%g free_units=%g total_units=%g used_inodes_pct=%g\n", | 267 | 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", |
265 | me->me_mountdir, dused_pct, dfree_pct, dused_units, dfree_units, dtotal_units, dused_inodes_percent); | 268 | me->me_mountdir, dused_pct, dfree_pct, dused_units, dfree_units, dtotal_units, dused_inodes_percent, dfree_inodes_percent); |
266 | } | 269 | } |
267 | 270 | ||
268 | /* Threshold comparisons */ | 271 | /* Threshold comparisons */ |
@@ -287,6 +290,10 @@ main (int argc, char **argv) | |||
287 | if (verbose >=3) printf("Usedinodes_percent result=%d\n", temp_result); | 290 | if (verbose >=3) printf("Usedinodes_percent result=%d\n", temp_result); |
288 | disk_result = max_state( disk_result, temp_result ); | 291 | disk_result = max_state( disk_result, temp_result ); |
289 | 292 | ||
293 | temp_result = get_status(dfree_inodes_percent, path->freeinodes_percent); | ||
294 | if (verbose >=3) printf("Freeinodes_percent result=%d\n", temp_result); | ||
295 | disk_result = max_state( disk_result, temp_result ); | ||
296 | |||
290 | result = max_state(result, disk_result); | 297 | result = max_state(result, disk_result); |
291 | 298 | ||
292 | /* What a mess of units. The output shows free space, the perf data shows used space. Yikes! | 299 | /* What a mess of units. The output shows free space, the perf data shows used space. Yikes! |
@@ -309,8 +316,8 @@ main (int argc, char **argv) | |||
309 | asprintf (&perf, "%s %s", perf, | 316 | asprintf (&perf, "%s %s", perf, |
310 | perfdata ((!strcmp(me->me_mountdir, "none") || display_mntp) ? me->me_devname : me->me_mountdir, | 317 | perfdata ((!strcmp(me->me_mountdir, "none") || display_mntp) ? me->me_devname : me->me_mountdir, |
311 | dused_units, units, | 318 | dused_units, units, |
312 | TRUE, warning_high_tide, | 319 | (warning_high_tide != UINT_MAX ? TRUE : FALSE), warning_high_tide, |
313 | TRUE, critical_high_tide, | 320 | (critical_high_tide != UINT_MAX ? TRUE : FALSE), critical_high_tide, |
314 | TRUE, 0, | 321 | TRUE, 0, |
315 | TRUE, dtotal_units)); | 322 | TRUE, dtotal_units)); |
316 | 323 | ||
@@ -477,10 +484,18 @@ process_arguments (int argc, char **argv) | |||
477 | break; | 484 | break; |
478 | 485 | ||
479 | case 'W': /* warning inode threshold */ | 486 | case 'W': /* warning inode threshold */ |
480 | warn_usedinodes_percent = optarg; | 487 | if (*optarg == '@') { |
488 | warn_freeinodes_percent = optarg; | ||
489 | } else { | ||
490 | asprintf(&warn_freeinodes_percent, "@%s", optarg); | ||
491 | } | ||
481 | break; | 492 | break; |
482 | case 'K': /* critical inode threshold */ | 493 | case 'K': /* critical inode threshold */ |
483 | crit_usedinodes_percent = optarg; | 494 | if (*optarg == '@') { |
495 | crit_freeinodes_percent = optarg; | ||
496 | } else { | ||
497 | asprintf(&crit_freeinodes_percent, "@%s", optarg); | ||
498 | } | ||
484 | break; | 499 | break; |
485 | case 'u': | 500 | case 'u': |
486 | if (units) | 501 | if (units) |
@@ -525,7 +540,7 @@ process_arguments (int argc, char **argv) | |||
525 | if (! (warn_freespace_units || crit_freespace_units || warn_freespace_percent || | 540 | if (! (warn_freespace_units || crit_freespace_units || warn_freespace_percent || |
526 | crit_freespace_percent || warn_usedspace_units || crit_usedspace_units || | 541 | crit_freespace_percent || warn_usedspace_units || crit_usedspace_units || |
527 | warn_usedspace_percent || crit_usedspace_percent || warn_usedinodes_percent || | 542 | warn_usedspace_percent || crit_usedspace_percent || warn_usedinodes_percent || |
528 | crit_usedinodes_percent)) { | 543 | crit_usedinodes_percent || warn_freeinodes_percent || crit_freeinodes_percent )) { |
529 | die (STATE_UNKNOWN, "DISK %s: %s", _("UNKNOWN"), _("Must set a threshold value before using -p\n")); | 544 | die (STATE_UNKNOWN, "DISK %s: %s", _("UNKNOWN"), _("Must set a threshold value before using -p\n")); |
530 | } | 545 | } |
531 | se = np_add_parameter(&path_select_list, optarg); | 546 | se = np_add_parameter(&path_select_list, optarg); |
@@ -534,6 +549,7 @@ process_arguments (int argc, char **argv) | |||
534 | set_thresholds(&se->usedspace_units, warn_usedspace_units, crit_usedspace_units); | 549 | set_thresholds(&se->usedspace_units, warn_usedspace_units, crit_usedspace_units); |
535 | set_thresholds(&se->usedspace_percent, warn_usedspace_percent, crit_usedspace_percent); | 550 | set_thresholds(&se->usedspace_percent, warn_usedspace_percent, crit_usedspace_percent); |
536 | set_thresholds(&se->usedinodes_percent, warn_usedinodes_percent, crit_usedinodes_percent); | 551 | set_thresholds(&se->usedinodes_percent, warn_usedinodes_percent, crit_usedinodes_percent); |
552 | set_thresholds(&se->freeinodes_percent, warn_freeinodes_percent, crit_freeinodes_percent); | ||
537 | break; | 553 | break; |
538 | case 'x': /* exclude path or partition */ | 554 | case 'x': /* exclude path or partition */ |
539 | np_add_name(&dp_exclude_list, optarg); | 555 | np_add_name(&dp_exclude_list, optarg); |
@@ -567,6 +583,8 @@ process_arguments (int argc, char **argv) | |||
567 | crit_usedspace_percent = NULL; | 583 | crit_usedspace_percent = NULL; |
568 | warn_usedinodes_percent = NULL; | 584 | warn_usedinodes_percent = NULL; |
569 | crit_usedinodes_percent = NULL; | 585 | crit_usedinodes_percent = NULL; |
586 | warn_freeinodes_percent = NULL; | ||
587 | crit_freeinodes_percent = NULL; | ||
570 | break; | 588 | break; |
571 | case 'V': /* version */ | 589 | case 'V': /* version */ |
572 | print_revision (progname, revision); | 590 | print_revision (progname, revision); |
@@ -594,6 +612,7 @@ process_arguments (int argc, char **argv) | |||
594 | set_thresholds(&se->usedspace_units, warn_usedspace_units, crit_usedspace_units); | 612 | set_thresholds(&se->usedspace_units, warn_usedspace_units, crit_usedspace_units); |
595 | set_thresholds(&se->usedspace_percent, warn_usedspace_percent, crit_usedspace_percent); | 613 | set_thresholds(&se->usedspace_percent, warn_usedspace_percent, crit_usedspace_percent); |
596 | set_thresholds(&se->usedinodes_percent, warn_usedinodes_percent, crit_usedinodes_percent); | 614 | set_thresholds(&se->usedinodes_percent, warn_usedinodes_percent, crit_usedinodes_percent); |
615 | set_thresholds(&se->freeinodes_percent, warn_freeinodes_percent, crit_freeinodes_percent); | ||
597 | } | 616 | } |
598 | 617 | ||
599 | if (units == NULL) { | 618 | if (units == NULL) { |