summaryrefslogtreecommitdiffstats
path: root/plugins/check_disk.c
diff options
context:
space:
mode:
authorSven Nierlein <sven@consol.de>2023-11-27 13:00:57 +0100
committerSven Nierlein <sven@consol.de>2023-11-27 13:04:10 +0100
commit579db5a93071547f5484c1690b621a60b46b2e1e (patch)
tree63ae74bb66e65077ab0c1a0b32828c15cfb11eaf /plugins/check_disk.c
parentf59c51601122ceac7ef4571d1993a34728e76813 (diff)
downloadmonitoring-plugins-579db5a.tar.gz
check_disk: fix ignore-missing in combination with includes (fixes #1963)
Using --ignore-missing together with regex matching and ignore option lead to a wrong error message. ./check_disk -n -w 10% -c 5% -W 10% -r /dummy -i /dummy2 DISK UNKNOWN: Paths need to be selected before using -i/-I. Use -A to select all paths explicitly The use case here is a cluster with fail-over mounts. So it is a valid situation that the regex match does not find anything in addtition with a ignore which also does not exist. After this patch: ./check_disk -n -w 10% -c 5% -W 10% -r /dummy -i /dummy2 DISK OK - No disks were found for provided parameters|
Diffstat (limited to 'plugins/check_disk.c')
-rw-r--r--plugins/check_disk.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/plugins/check_disk.c b/plugins/check_disk.c
index e9a9ddd7..c6bba243 100644
--- a/plugins/check_disk.c
+++ b/plugins/check_disk.c
@@ -451,7 +451,7 @@ main (int argc, char **argv)
451 451
452 if (strcmp(output, "") == 0 && ! erronly) { 452 if (strcmp(output, "") == 0 && ! erronly) {
453 preamble = ""; 453 preamble = "";
454 xasprintf (&output, " - No disks were found for provided parameters;"); 454 xasprintf (&output, " - No disks were found for provided parameters");
455 } 455 }
456 456
457 printf ("DISK %s%s%s%s%s|%s\n", state_text (result), ((erronly && result==STATE_OK)) ? "" : preamble, output, (strcmp(ignored, "") == 0) ? "" : ignored_preamble, ignored, perf); 457 printf ("DISK %s%s%s%s%s|%s\n", state_text (result), ((erronly && result==STATE_OK)) ? "" : preamble, output, (strcmp(ignored, "") == 0) ? "" : ignored_preamble, ignored, perf);
@@ -831,7 +831,7 @@ process_arguments (int argc, char **argv)
831 831
832 if (!fnd && ignore_missing == true) { 832 if (!fnd && ignore_missing == true) {
833 path_ignored = true; 833 path_ignored = true;
834 /* path_selected = true;*/ 834 path_selected = true;
835 break; 835 break;
836 } else if (!fnd) 836 } else if (!fnd)
837 die (STATE_UNKNOWN, "DISK %s: %s - %s\n",_("UNKNOWN"), 837 die (STATE_UNKNOWN, "DISK %s: %s - %s\n",_("UNKNOWN"),