diff options
author | Lorenz Kästle <12514511+RincewindsHat@users.noreply.github.com> | 2023-11-27 15:57:49 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-11-27 15:57:49 +0100 |
commit | c2ddda30e043bb62b30ca5d25dba8379697b6340 (patch) | |
tree | 63ae74bb66e65077ab0c1a0b32828c15cfb11eaf /plugins/check_disk.c | |
parent | df690d695763ebbfebb60e22656ddea6cecb6690 (diff) | |
parent | 579db5a93071547f5484c1690b621a60b46b2e1e (diff) | |
download | monitoring-plugins-c2ddda3.tar.gz |
Merge pull request #1967 from sni/fix_check_disk
check_disk: fix ignore-missing in combination with includes (fixes #1963)
Diffstat (limited to 'plugins/check_disk.c')
-rw-r--r-- | plugins/check_disk.c | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/plugins/check_disk.c b/plugins/check_disk.c index a4180ca7..c6bba243 100644 --- a/plugins/check_disk.c +++ b/plugins/check_disk.c | |||
@@ -112,8 +112,7 @@ enum | |||
112 | { | 112 | { |
113 | SYNC_OPTION = CHAR_MAX + 1, | 113 | SYNC_OPTION = CHAR_MAX + 1, |
114 | NO_SYNC_OPTION, | 114 | NO_SYNC_OPTION, |
115 | BLOCK_SIZE_OPTION, | 115 | BLOCK_SIZE_OPTION |
116 | IGNORE_MISSING | ||
117 | }; | 116 | }; |
118 | 117 | ||
119 | #ifdef _AIX | 118 | #ifdef _AIX |
@@ -452,7 +451,7 @@ main (int argc, char **argv) | |||
452 | 451 | ||
453 | if (strcmp(output, "") == 0 && ! erronly) { | 452 | if (strcmp(output, "") == 0 && ! erronly) { |
454 | preamble = ""; | 453 | preamble = ""; |
455 | xasprintf (&output, " - No disks were found for provided parameters;"); | 454 | xasprintf (&output, " - No disks were found for provided parameters"); |
456 | } | 455 | } |
457 | 456 | ||
458 | 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); |
@@ -524,7 +523,7 @@ process_arguments (int argc, char **argv) | |||
524 | {"ignore-ereg-partition", required_argument, 0, 'i'}, | 523 | {"ignore-ereg-partition", required_argument, 0, 'i'}, |
525 | {"ignore-eregi-path", required_argument, 0, 'I'}, | 524 | {"ignore-eregi-path", required_argument, 0, 'I'}, |
526 | {"ignore-eregi-partition", required_argument, 0, 'I'}, | 525 | {"ignore-eregi-partition", required_argument, 0, 'I'}, |
527 | {"ignore-missing", no_argument, 0, IGNORE_MISSING}, | 526 | {"ignore-missing", no_argument, 0, 'n'}, |
528 | {"local", no_argument, 0, 'l'}, | 527 | {"local", no_argument, 0, 'l'}, |
529 | {"stat-remote-fs", no_argument, 0, 'L'}, | 528 | {"stat-remote-fs", no_argument, 0, 'L'}, |
530 | {"iperfdata", no_argument, 0, 'P'}, | 529 | {"iperfdata", no_argument, 0, 'P'}, |
@@ -550,7 +549,7 @@ process_arguments (int argc, char **argv) | |||
550 | strcpy (argv[c], "-t"); | 549 | strcpy (argv[c], "-t"); |
551 | 550 | ||
552 | while (1) { | 551 | while (1) { |
553 | c = getopt_long (argc, argv, "+?VqhvefCt:c:w:K:W:u:p:x:X:N:mklLPg:R:r:i:I:MEA", longopts, &option); | 552 | c = getopt_long (argc, argv, "+?VqhvefCt:c:w:K:W:u:p:x:X:N:mklLPg:R:r:i:I:MEAn", longopts, &option); |
554 | 553 | ||
555 | if (c == -1 || c == EOF) | 554 | if (c == -1 || c == EOF) |
556 | break; | 555 | break; |
@@ -792,7 +791,7 @@ process_arguments (int argc, char **argv) | |||
792 | cflags = default_cflags; | 791 | cflags = default_cflags; |
793 | break; | 792 | break; |
794 | 793 | ||
795 | case IGNORE_MISSING: | 794 | case 'n': |
796 | ignore_missing = true; | 795 | ignore_missing = true; |
797 | break; | 796 | break; |
798 | case 'A': | 797 | case 'A': |
@@ -832,7 +831,7 @@ process_arguments (int argc, char **argv) | |||
832 | 831 | ||
833 | if (!fnd && ignore_missing == true) { | 832 | if (!fnd && ignore_missing == true) { |
834 | path_ignored = true; | 833 | path_ignored = true; |
835 | /* path_selected = true;*/ | 834 | path_selected = true; |
836 | break; | 835 | break; |
837 | } else if (!fnd) | 836 | } else if (!fnd) |
838 | die (STATE_UNKNOWN, "DISK %s: %s - %s\n",_("UNKNOWN"), | 837 | die (STATE_UNKNOWN, "DISK %s: %s - %s\n",_("UNKNOWN"), |
@@ -1004,7 +1003,7 @@ print_help (void) | |||
1004 | printf (" %s\n", _("Regular expression to ignore selected path/partition (case insensitive) (may be repeated)")); | 1003 | printf (" %s\n", _("Regular expression to ignore selected path/partition (case insensitive) (may be repeated)")); |
1005 | printf (" %s\n", "-i, --ignore-ereg-path=PATH, --ignore-ereg-partition=PARTITION"); | 1004 | printf (" %s\n", "-i, --ignore-ereg-path=PATH, --ignore-ereg-partition=PARTITION"); |
1006 | printf (" %s\n", _("Regular expression to ignore selected path or partition (may be repeated)")); | 1005 | printf (" %s\n", _("Regular expression to ignore selected path or partition (may be repeated)")); |
1007 | printf (" %s\n", "--ignore-missing"); | 1006 | printf (" %s\n", "-n, --ignore-missing"); |
1008 | printf (" %s\n", _("Return OK if no filesystem matches, filesystem does not exist or is inaccessible.")); | 1007 | printf (" %s\n", _("Return OK if no filesystem matches, filesystem does not exist or is inaccessible.")); |
1009 | printf (" %s\n", _("(Provide this option before -p / -r / --ereg-path if used)")); | 1008 | printf (" %s\n", _("(Provide this option before -p / -r / --ereg-path if used)")); |
1010 | printf (UT_PLUG_TIMEOUT, DEFAULT_SOCKET_TIMEOUT); | 1009 | printf (UT_PLUG_TIMEOUT, DEFAULT_SOCKET_TIMEOUT); |