diff options
Diffstat (limited to 'web/attachments/56028-check_disk.patch')
-rw-r--r-- | web/attachments/56028-check_disk.patch | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/web/attachments/56028-check_disk.patch b/web/attachments/56028-check_disk.patch new file mode 100644 index 0000000..a29ebea --- /dev/null +++ b/web/attachments/56028-check_disk.patch | |||
@@ -0,0 +1,53 @@ | |||
1 | Index: check_disk.c | ||
2 | =================================================================== | ||
3 | RCS file: /usr/local/cvs/root/nagios-plugins/plugins/check_disk.c,v | ||
4 | retrieving revision 1.1 | ||
5 | diff -u -u -r1.1 check_disk.c | ||
6 | --- check_disk.c 3 Jul 2003 23:27:44 -0000 1.1 | ||
7 | +++ check_disk.c 17 Jul 2003 02:29:24 -0000 | ||
8 | @@ -307,13 +310,18 @@ | ||
9 | { | ||
10 | int result = STATE_UNKNOWN; | ||
11 | /* check the percent used space against thresholds */ | ||
12 | - if (usp >= 0 && usp >= (100.0 - c_dfp)) | ||
13 | + /* Need to check the percent && the free space against thresholds */ | ||
14 | + if (c_dfp >= 0 && c_df >= 0 && usp >= 0 && usp >= (100.0 - c_dfp) && c_df >= 0 && free_disk <= c_df) | ||
15 | result = STATE_CRITICAL; | ||
16 | - else if (c_df >= 0 && free_disk <= c_df) | ||
17 | + else if (c_df < 0 && usp >= 0 && usp >= (100.0 - c_dfp)) | ||
18 | result = STATE_CRITICAL; | ||
19 | - else if (usp >= 0 && usp >= (100.0 - w_dfp)) | ||
20 | + else if (c_dfp < 0 && free_disk <= c_df) | ||
21 | + result = STATE_CRITICAL; | ||
22 | + else if (w_dfp >= 0 && w_df >= 0 && usp >= 0 && usp >= (100.0 - w_dfp) && w_df >= 0 && free_disk <= w_df) | ||
23 | + result = STATE_WARNING; | ||
24 | + else if (w_df < 0 && usp >= 0 && usp >= (100.0 - w_dfp)) | ||
25 | result = STATE_WARNING; | ||
26 | - else if (w_df >= 0 && free_disk <= w_df) | ||
27 | + else if (w_dfp < 0 && free_disk <= w_df) | ||
28 | result = STATE_WARNING; | ||
29 | else if (usp >= 0.0) | ||
30 | result = STATE_OK; | ||
31 | @@ -328,7 +336,9 @@ | ||
32 | ("Copyright (c) 2000 Ethan Galstad/Karl DeBisschop\n\n" | ||
33 | "This plugin will check the percent of used disk space on a mounted\n" | ||
34 | "file system and generate an alert if percentage is above one of the\n" | ||
35 | - "threshold values.\n\n"); | ||
36 | + "threshold values. You can also pass a percent and size thresholds\n" | ||
37 | + "separated by a : or , and both values will have to be met before a\n" | ||
38 | + "failure occurs\n\n"); | ||
39 | print_usage (); | ||
40 | printf | ||
41 | ("\nOptions:\n" | ||
42 | @@ -352,7 +362,10 @@ | ||
43 | " Show details for command-line debugging (do not use with nagios server)\n" | ||
44 | " -h, --help\n" | ||
45 | " Print detailed help screen\n" | ||
46 | - " -V, --version\n" " Print version information\n\n"); | ||
47 | + " -V, --version\n" " Print version information\n" | ||
48 | + "Examples:\n" | ||
49 | + "./check_disk -w10%%:100000 -c5%%:50000 -p /\n" | ||
50 | + "Will require that the / partition have less than 10%% free space AND less than 100mb free\n\n"); | ||
51 | support (); | ||
52 | } | ||
53 | |||