diff options
Diffstat (limited to 'plugins/check_overcr.c')
-rw-r--r-- | plugins/check_overcr.c | 36 |
1 files changed, 18 insertions, 18 deletions
diff --git a/plugins/check_overcr.c b/plugins/check_overcr.c index 9a4d25f..5165c82 100644 --- a/plugins/check_overcr.c +++ b/plugins/check_overcr.c | |||
@@ -56,15 +56,15 @@ char *server_address = NULL; | |||
56 | int server_port = PORT; | 56 | int server_port = PORT; |
57 | double warning_value = 0L; | 57 | double warning_value = 0L; |
58 | double critical_value = 0L; | 58 | double critical_value = 0L; |
59 | int check_warning_value = FALSE; | 59 | bool check_warning_value = false; |
60 | int check_critical_value = FALSE; | 60 | bool check_critical_value = false; |
61 | enum checkvar vars_to_check = NONE; | 61 | enum checkvar vars_to_check = NONE; |
62 | int cmd_timeout = 1; | 62 | int cmd_timeout = 1; |
63 | 63 | ||
64 | int netstat_port = 0; | 64 | int netstat_port = 0; |
65 | char *disk_name = NULL; | 65 | char *disk_name = NULL; |
66 | char *process_name = NULL; | 66 | char *process_name = NULL; |
67 | char send_buffer[MAX_INPUT_BUFFER]; | 67 | char send_buffer[MAX_INPUT_BUFFER]; |
68 | 68 | ||
69 | int process_arguments (int, char **); | 69 | int process_arguments (int, char **); |
70 | void print_usage (void); | 70 | void print_usage (void); |
@@ -77,7 +77,7 @@ main (int argc, char **argv) | |||
77 | char recv_buffer[MAX_INPUT_BUFFER]; | 77 | char recv_buffer[MAX_INPUT_BUFFER]; |
78 | char temp_buffer[MAX_INPUT_BUFFER]; | 78 | char temp_buffer[MAX_INPUT_BUFFER]; |
79 | char *temp_ptr = NULL; | 79 | char *temp_ptr = NULL; |
80 | int found_disk = FALSE; | 80 | bool found_disk = false; |
81 | unsigned long percent_used_disk_space = 100; | 81 | unsigned long percent_used_disk_space = 100; |
82 | double load; | 82 | double load; |
83 | double load_1min; | 83 | double load_1min; |
@@ -155,9 +155,9 @@ main (int argc, char **argv) | |||
155 | break; | 155 | break; |
156 | } | 156 | } |
157 | 157 | ||
158 | if (check_critical_value == TRUE && (load >= critical_value)) | 158 | if (check_critical_value && (load >= critical_value)) |
159 | result = STATE_CRITICAL; | 159 | result = STATE_CRITICAL; |
160 | else if (check_warning_value == TRUE && (load >= warning_value)) | 160 | else if (check_warning_value && (load >= warning_value)) |
161 | result = STATE_WARNING; | 161 | result = STATE_WARNING; |
162 | 162 | ||
163 | die (result, | 163 | die (result, |
@@ -178,7 +178,7 @@ main (int argc, char **argv) | |||
178 | temp_ptr = (char *) strtok (NULL, " ")) { | 178 | temp_ptr = (char *) strtok (NULL, " ")) { |
179 | 179 | ||
180 | if (!strcmp (temp_ptr, disk_name)) { | 180 | if (!strcmp (temp_ptr, disk_name)) { |
181 | found_disk = TRUE; | 181 | found_disk = true; |
182 | temp_ptr = (char *) strtok (NULL, "%"); | 182 | temp_ptr = (char *) strtok (NULL, "%"); |
183 | if (temp_ptr == NULL) | 183 | if (temp_ptr == NULL) |
184 | die (STATE_CRITICAL, _("Invalid response from server\n")); | 184 | die (STATE_CRITICAL, _("Invalid response from server\n")); |
@@ -191,14 +191,14 @@ main (int argc, char **argv) | |||
191 | } | 191 | } |
192 | 192 | ||
193 | /* error if we couldn't find the info for the disk */ | 193 | /* error if we couldn't find the info for the disk */ |
194 | if (found_disk == FALSE) | 194 | if (!found_disk) |
195 | die (STATE_CRITICAL, | 195 | die (STATE_CRITICAL, |
196 | "CRITICAL - Disk '%s' non-existent or not mounted", | 196 | "CRITICAL - Disk '%s' non-existent or not mounted", |
197 | disk_name); | 197 | disk_name); |
198 | 198 | ||
199 | if (check_critical_value == TRUE && (percent_used_disk_space >= critical_value)) | 199 | if (check_critical_value && (percent_used_disk_space >= critical_value)) |
200 | result = STATE_CRITICAL; | 200 | result = STATE_CRITICAL; |
201 | else if (check_warning_value == TRUE && (percent_used_disk_space >= warning_value)) | 201 | else if (check_warning_value && (percent_used_disk_space >= warning_value)) |
202 | result = STATE_WARNING; | 202 | result = STATE_WARNING; |
203 | 203 | ||
204 | die (result, "Disk %s - %lu%% used on %s", state_text(result), percent_used_disk_space, disk_name); | 204 | die (result, "Disk %s - %lu%% used on %s", state_text(result), percent_used_disk_space, disk_name); |
@@ -212,9 +212,9 @@ main (int argc, char **argv) | |||
212 | else | 212 | else |
213 | port_connections = strtod (recv_buffer, NULL); | 213 | port_connections = strtod (recv_buffer, NULL); |
214 | 214 | ||
215 | if (check_critical_value == TRUE && (port_connections >= critical_value)) | 215 | if (check_critical_value && (port_connections >= critical_value)) |
216 | result = STATE_CRITICAL; | 216 | result = STATE_CRITICAL; |
217 | else if (check_warning_value == TRUE && (port_connections >= warning_value)) | 217 | else if (check_warning_value && (port_connections >= warning_value)) |
218 | result = STATE_WARNING; | 218 | result = STATE_WARNING; |
219 | 219 | ||
220 | die (result, | 220 | die (result, |
@@ -241,9 +241,9 @@ main (int argc, char **argv) | |||
241 | else | 241 | else |
242 | processes = strtod (temp_ptr, NULL); | 242 | processes = strtod (temp_ptr, NULL); |
243 | 243 | ||
244 | if (check_critical_value == TRUE && (processes >= critical_value)) | 244 | if (check_critical_value && (processes >= critical_value)) |
245 | result = STATE_CRITICAL; | 245 | result = STATE_CRITICAL; |
246 | else if (check_warning_value == TRUE && (processes >= warning_value)) | 246 | else if (check_warning_value && (processes >= warning_value)) |
247 | result = STATE_WARNING; | 247 | result = STATE_WARNING; |
248 | 248 | ||
249 | die (result, | 249 | die (result, |
@@ -262,9 +262,9 @@ main (int argc, char **argv) | |||
262 | uptime_raw_hours = strtod (recv_buffer, NULL); | 262 | uptime_raw_hours = strtod (recv_buffer, NULL); |
263 | uptime_raw_minutes = (unsigned long) (uptime_raw_hours * 60.0); | 263 | uptime_raw_minutes = (unsigned long) (uptime_raw_hours * 60.0); |
264 | 264 | ||
265 | if (check_critical_value == TRUE && (uptime_raw_minutes <= critical_value)) | 265 | if (check_critical_value && (uptime_raw_minutes <= critical_value)) |
266 | result = STATE_CRITICAL; | 266 | result = STATE_CRITICAL; |
267 | else if (check_warning_value == TRUE && (uptime_raw_minutes <= warning_value)) | 267 | else if (check_warning_value && (uptime_raw_minutes <= warning_value)) |
268 | result = STATE_WARNING; | 268 | result = STATE_WARNING; |
269 | 269 | ||
270 | uptime_days = uptime_raw_minutes / 1440; | 270 | uptime_days = uptime_raw_minutes / 1440; |
@@ -388,11 +388,11 @@ process_arguments (int argc, char **argv) | |||
388 | break; | 388 | break; |
389 | case 'w': /* warning threshold */ | 389 | case 'w': /* warning threshold */ |
390 | warning_value = strtoul (optarg, NULL, 10); | 390 | warning_value = strtoul (optarg, NULL, 10); |
391 | check_warning_value = TRUE; | 391 | check_warning_value = true; |
392 | break; | 392 | break; |
393 | case 'c': /* critical threshold */ | 393 | case 'c': /* critical threshold */ |
394 | critical_value = strtoul (optarg, NULL, 10); | 394 | critical_value = strtoul (optarg, NULL, 10); |
395 | check_critical_value = TRUE; | 395 | check_critical_value = true; |
396 | break; | 396 | break; |
397 | case 't': /* timeout */ | 397 | case 't': /* timeout */ |
398 | socket_timeout = atoi (optarg); | 398 | socket_timeout = atoi (optarg); |