blob: a29ebea26124af30094a27417ab4776bb499edd9 (
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
|
Index: check_disk.c
===================================================================
RCS file: /usr/local/cvs/root/nagios-plugins/plugins/check_disk.c,v
retrieving revision 1.1
diff -u -u -r1.1 check_disk.c
--- check_disk.c 3 Jul 2003 23:27:44 -0000 1.1
+++ check_disk.c 17 Jul 2003 02:29:24 -0000
@@ -307,13 +310,18 @@
{
int result = STATE_UNKNOWN;
/* check the percent used space against thresholds */
- if (usp >= 0 && usp >= (100.0 - c_dfp))
+ /* Need to check the percent && the free space against thresholds */
+ if (c_dfp >= 0 && c_df >= 0 && usp >= 0 && usp >= (100.0 - c_dfp) && c_df >= 0 && free_disk <= c_df)
result = STATE_CRITICAL;
- else if (c_df >= 0 && free_disk <= c_df)
+ else if (c_df < 0 && usp >= 0 && usp >= (100.0 - c_dfp))
result = STATE_CRITICAL;
- else if (usp >= 0 && usp >= (100.0 - w_dfp))
+ else if (c_dfp < 0 && free_disk <= c_df)
+ result = STATE_CRITICAL;
+ else if (w_dfp >= 0 && w_df >= 0 && usp >= 0 && usp >= (100.0 - w_dfp) && w_df >= 0 && free_disk <= w_df)
+ result = STATE_WARNING;
+ else if (w_df < 0 && usp >= 0 && usp >= (100.0 - w_dfp))
result = STATE_WARNING;
- else if (w_df >= 0 && free_disk <= w_df)
+ else if (w_dfp < 0 && free_disk <= w_df)
result = STATE_WARNING;
else if (usp >= 0.0)
result = STATE_OK;
@@ -328,7 +336,9 @@
("Copyright (c) 2000 Ethan Galstad/Karl DeBisschop\n\n"
"This plugin will check the percent of used disk space on a mounted\n"
"file system and generate an alert if percentage is above one of the\n"
- "threshold values.\n\n");
+ "threshold values. You can also pass a percent and size thresholds\n"
+ "separated by a : or , and both values will have to be met before a\n"
+ "failure occurs\n\n");
print_usage ();
printf
("\nOptions:\n"
@@ -352,7 +362,10 @@
" Show details for command-line debugging (do not use with nagios server)\n"
" -h, --help\n"
" Print detailed help screen\n"
- " -V, --version\n" " Print version information\n\n");
+ " -V, --version\n" " Print version information\n"
+ "Examples:\n"
+ "./check_disk -w10%%:100000 -c5%%:50000 -p /\n"
+ "Will require that the / partition have less than 10%% free space AND less than 100mb free\n\n");
support ();
}
|