diff options
Diffstat (limited to 'web/attachments/26866-check_disk.noerr-exclude.patch')
| -rw-r--r-- | web/attachments/26866-check_disk.noerr-exclude.patch | 130 |
1 files changed, 130 insertions, 0 deletions
diff --git a/web/attachments/26866-check_disk.noerr-exclude.patch b/web/attachments/26866-check_disk.noerr-exclude.patch new file mode 100644 index 0000000..4f12559 --- /dev/null +++ b/web/attachments/26866-check_disk.noerr-exclude.patch | |||
| @@ -0,0 +1,130 @@ | |||
| 1 | 10c10 | ||
| 2 | < * $Id: check_disk.c,v 1.3 2002/06/19 03:09:10 sghosh Exp $ | ||
| 3 | --- | ||
| 4 | > * $Id: check_disk.c,v 1.2 2002/06/06 04:15:49 sghosh Exp $ | ||
| 5 | 53d52 | ||
| 6 | < char *exclude_device = NULL; | ||
| 7 | 56d54 | ||
| 8 | < int display_errors_only = FALSE; | ||
| 9 | 67d64 | ||
| 10 | < int temp_result = STATE_UNKNOWN; | ||
| 11 | 105,156c102,106 | ||
| 12 | < /* cannot use max now that STATE_UNKNOWN is greater than STATE_CRITICAL | ||
| 13 | < result = max (result, check_disk (usp, free_disk)); */ | ||
| 14 | < temp_result = check_disk (usp, free_disk) ; | ||
| 15 | < | ||
| 16 | < if (exclude_device && !strcmp(exclude_device,file_system)) { | ||
| 17 | < if (verbose) | ||
| 18 | < printf ("ignoring %s.", file_system); | ||
| 19 | < temp_result = STATE_OK; | ||
| 20 | < } | ||
| 21 | < | ||
| 22 | < if ( temp_result == STATE_CRITICAL ) { | ||
| 23 | < result = STATE_CRITICAL; | ||
| 24 | < } | ||
| 25 | < else if (temp_result == STATE_WARNING) { | ||
| 26 | < if ( !( result == STATE_CRITICAL) ) { | ||
| 27 | < result = STATE_WARNING; | ||
| 28 | < } | ||
| 29 | < } | ||
| 30 | < else if (temp_result == STATE_OK) { | ||
| 31 | < if ( ! ( result == STATE_CRITICAL || result == STATE_WARNING) ){ | ||
| 32 | < result = STATE_OK; | ||
| 33 | < } | ||
| 34 | < } | ||
| 35 | < else if (temp_result == STATE_UNKNOWN) { | ||
| 36 | < if ( ! ( result == STATE_CRITICAL || result == STATE_WARNING || result == STATE_OK) ){ | ||
| 37 | < result = STATE_UNKNOWN; | ||
| 38 | < } | ||
| 39 | < } | ||
| 40 | < else { | ||
| 41 | < /* don't have a match with the return value from check_disk() */ | ||
| 42 | < result = STATE_UNKNOWN; | ||
| 43 | < } | ||
| 44 | < | ||
| 45 | < | ||
| 46 | < if (display_errors_only) { | ||
| 47 | < if (temp_result != STATE_OK) { | ||
| 48 | < len = | ||
| 49 | < snprintf (outbuf, MAX_INPUT_BUFFER - 1, | ||
| 50 | < " [%d kB (%d%%) free on %s]", free_disk, 100 - usp, | ||
| 51 | < display_mntp ? mntp : file_system); | ||
| 52 | < } | ||
| 53 | < else { | ||
| 54 | < len = 0; | ||
| 55 | < } | ||
| 56 | < } | ||
| 57 | < else { | ||
| 58 | < len = | ||
| 59 | < snprintf (outbuf, MAX_INPUT_BUFFER - 1, | ||
| 60 | < " [%d kB (%d%%) free on %s]", free_disk, 100 - usp, | ||
| 61 | < display_mntp ? mntp : file_system); | ||
| 62 | < } | ||
| 63 | < | ||
| 64 | --- | ||
| 65 | > result = max (result, check_disk (usp, free_disk)); | ||
| 66 | > len = | ||
| 67 | > snprintf (outbuf, MAX_INPUT_BUFFER - 1, | ||
| 68 | > " [%d kB (%d%%) free on %s]", free_disk, 100 - usp, | ||
| 69 | > display_mntp ? mntp : file_system); | ||
| 70 | 161,162c111,112 | ||
| 71 | < printf ("Unable to read output:\n%s\n%s\n", command_line, input_buffer); | ||
| 72 | < return result; | ||
| 73 | --- | ||
| 74 | > printf ("Unable to read output:\n%s\n%s\n", command_line, input_buffer); | ||
| 75 | > return result; | ||
| 76 | 168,171c118 | ||
| 77 | < /*result = max (result, STATE_WARNING); */ | ||
| 78 | < if( !( result == STATE_CRITICAL) ) { | ||
| 79 | < result = STATE_WARNING; | ||
| 80 | < } | ||
| 81 | --- | ||
| 82 | > result = max (result, STATE_WARNING); | ||
| 83 | 178,181c125,126 | ||
| 84 | < /*result = max (result, STATE_WARNING); */ | ||
| 85 | < if( !( result == STATE_CRITICAL) ) { | ||
| 86 | < result = STATE_WARNING; | ||
| 87 | < } | ||
| 88 | --- | ||
| 89 | > result = max (result, STATE_WARNING); | ||
| 90 | > | ||
| 91 | 241d185 | ||
| 92 | < {"exclude_device", required_argument, 0, 'x'}, | ||
| 93 | 246d189 | ||
| 94 | < {"errors-only", no_argument, 0, 'e'}, | ||
| 95 | 254c197 | ||
| 96 | < getopt_long (argc, argv, "+?Vehvt:c:w:p:x:m", long_options, &option_index); | ||
| 97 | --- | ||
| 98 | > getopt_long (argc, argv, "+?Vhvt:c:w:p:m", long_options, &option_index); | ||
| 99 | 256c199 | ||
| 100 | < c = getopt (argc, argv, "+?Vehvt:c:w:p:x:m"); | ||
| 101 | --- | ||
| 102 | > c = getopt (argc, argv, "+?Vhvt:c:w:p:m"); | ||
| 103 | 269d211 | ||
| 104 | < case 'x': | ||
| 105 | 317,319d258 | ||
| 106 | < case 'x': /* exclude path or partition */ | ||
| 107 | < exclude_device = optarg; | ||
| 108 | < break; | ||
| 109 | 326,328d264 | ||
| 110 | < case 'e': /* only display paths with error conditions */ | ||
| 111 | < display_errors_only = TRUE; | ||
| 112 | < break; | ||
| 113 | 330c266 | ||
| 114 | < print_revision (my_basename (argv[0]), "$Revision: 1.3 $"); | ||
| 115 | --- | ||
| 116 | > print_revision (my_basename (argv[0]), "$Revision: 1.2 $"); | ||
| 117 | 390c326 | ||
| 118 | < print_revision (PROGNAME, "$Revision: 1.3 $"); | ||
| 119 | --- | ||
| 120 | > print_revision (PROGNAME, "$Revision: 1.2 $"); | ||
| 121 | 409,410d344 | ||
| 122 | < " -x, --exclude_device=PATH\n" | ||
| 123 | < " Ignore device (only works if -p unspecified)\n" | ||
| 124 | 413,414d346 | ||
| 125 | < " -e, --errors-only\n" | ||
| 126 | < " Display only devices/mountpoints with errors\n" | ||
| 127 | 427c359 | ||
| 128 | < ("Usage: %s -w limit -c limit [-p path | -x device] [-t timeout] [-m] [-e] [--verbose]\n" | ||
| 129 | --- | ||
| 130 | > ("Usage: %s -w limit -c limit [-p path] [-t timeout] [-m] [--verbose]\n" | ||
