summaryrefslogtreecommitdiffstats
path: root/web/attachments/116576-check_nt.c.patch
blob: 30a465337f3fb6fb2da8dba24984f1fdcf88c5a0 (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
--- plugins/check_nt.c.orig	2005-01-20 17:17:40.000000000 -0500
+++ plugins/check_nt.c	2005-01-20 18:01:43.000000000 -0500
@@ -43,6 +43,7 @@
 #define CHECK_MEMUSE	7
 #define CHECK_COUNTER	8
 #define CHECK_FILEAGE	9
+#define CHECK_FREEDISKSPACE	10
 #define MAX_VALUE_LIST 30
 
 #define PORT	1248
@@ -185,7 +186,7 @@
 		return_code=STATE_OK;
 	}
 
-	else if(vars_to_check==CHECK_USEDDISKSPACE){
+	else if(vars_to_check==CHECK_USEDDISKSPACE || vars_to_check==CHECK_FREEDISKSPACE){
 
 		return_code=STATE_UNKNOWN;
 		if (check_value_list==TRUE) {
@@ -210,9 +211,13 @@
 							 free_disk_space / 1073741824, (free_disk_space / total_disk_space)*100);
 
 
-					if(check_critical_value==TRUE && percent_used_space >= critical_value)
+					if(check_critical_value==TRUE && (
+					    (vars_to_check==CHECK_USEDDISKSPACE && percent_used_space >= critical_value) ||
+					    (vars_to_check==CHECK_FREEDISKSPACE && free_disk_space / 1048576 <= critical_value)))
 						return_code=STATE_CRITICAL;
-					else if (check_warning_value==TRUE && percent_used_space >= warning_value)
+					else if (check_warning_value==TRUE && (
+					    (vars_to_check==CHECK_USEDDISKSPACE && percent_used_space >= warning_value) ||
+					    (vars_to_check==CHECK_FREEDISKSPACE && free_disk_space / 1048576 <= warning_value)))
 						return_code=STATE_WARNING;
 					else
 						return_code=STATE_OK;
@@ -477,6 +482,8 @@
 					vars_to_check=CHECK_COUNTER;
 				else if(!strcmp(optarg,"FILEAGE"))
 					vars_to_check=CHECK_FILEAGE;
+				else if(!strcmp(optarg,"FREEDISKSPACE"))
+					vars_to_check=CHECK_FREEDISKSPACE;
 				else
 					return ERROR;
 				break;
@@ -541,7 +548,9 @@
 		 "        Thresholds are percentage and up to 10 requests can be done in one shot. ie: -l 60,90,95,120,90,95\n"
 		 "      UPTIME = Get the uptime of the machine. No specific parameters. No warning or critical threshold\n"
 		 "      USEDDISKSPACE = Size and percentage of disk use. Request a -l parameter containing the drive letter only.\n"
-		 "                      Warning and critical thresholds can be specified with -w and -c.\n"
+		 "                      Warning and critical thresholds can be specified (in percentage used) with -w and -c.\n"
+		 "      FREEDISKSPACE = Size and percentage of disk use. Request a -l parameter containing the drive letter only.\n"
+		 "                      Warning and critical thresholds can be specified (in megabytes free) with -w and -c.\n"
 		 "      MEMUSE = Memory use. Warning and critical thresholds can be specified with -w and -c.\n"
 		 "      SERVICESTATE = Check the state of one or several services. Request a -l parameters with the following syntax:\n"
 		 "        -l <service1>,<service2>,<service3>,... You can specify -d SHOWALL in case you want to see working services\n"