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