diff options
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/check_disk.c | 5 | ||||
-rw-r--r-- | plugins/check_http.c | 2 | ||||
-rw-r--r-- | plugins/check_mysql.c | 35 |
3 files changed, 30 insertions, 12 deletions
diff --git a/plugins/check_disk.c b/plugins/check_disk.c index 39dc6cd..05e5502 100644 --- a/plugins/check_disk.c +++ b/plugins/check_disk.c | |||
@@ -131,9 +131,6 @@ bool stat_path (struct parameter_list *p); | |||
131 | void get_stats (struct parameter_list *p, struct fs_usage *fsp); | 131 | void get_stats (struct parameter_list *p, struct fs_usage *fsp); |
132 | void get_path_stats (struct parameter_list *p, struct fs_usage *fsp); | 132 | void get_path_stats (struct parameter_list *p, struct fs_usage *fsp); |
133 | 133 | ||
134 | double w_dfp = -1.0; | ||
135 | double c_dfp = -1.0; | ||
136 | char *path; | ||
137 | char *exclude_device; | 134 | char *exclude_device; |
138 | char *units; | 135 | char *units; |
139 | uintmax_t mult = 1024 * 1024; | 136 | uintmax_t mult = 1024 * 1024; |
@@ -889,7 +886,7 @@ process_arguments (int argc, char **argv) | |||
889 | if (crit_usedspace_percent == NULL && argc > c && is_intnonneg (argv[c])) | 886 | if (crit_usedspace_percent == NULL && argc > c && is_intnonneg (argv[c])) |
890 | crit_usedspace_percent = argv[c++]; | 887 | crit_usedspace_percent = argv[c++]; |
891 | 888 | ||
892 | if (argc > c && path == NULL) { | 889 | if (argc > c) { |
893 | se = np_add_parameter(&path_select_list, strdup(argv[c++])); | 890 | se = np_add_parameter(&path_select_list, strdup(argv[c++])); |
894 | path_selected = TRUE; | 891 | path_selected = TRUE; |
895 | set_all_thresholds(se); | 892 | set_all_thresholds(se); |
diff --git a/plugins/check_http.c b/plugins/check_http.c index 1288c41..718c8ee 100644 --- a/plugins/check_http.c +++ b/plugins/check_http.c | |||
@@ -1279,7 +1279,7 @@ check_http (void) | |||
1279 | 1279 | ||
1280 | regmatch_t chre_pmatch[1]; // We actually do not care about this, since we only want to know IF it was found | 1280 | regmatch_t chre_pmatch[1]; // We actually do not care about this, since we only want to know IF it was found |
1281 | 1281 | ||
1282 | if (regexec(&chunked_header_regex, header, 1, chre_pmatch, 0) == 0) { | 1282 | if (!no_body && regexec(&chunked_header_regex, header, 1, chre_pmatch, 0) == 0) { |
1283 | if (verbose) { | 1283 | if (verbose) { |
1284 | printf("Found chunked content\n"); | 1284 | printf("Found chunked content\n"); |
1285 | } | 1285 | } |
diff --git a/plugins/check_mysql.c b/plugins/check_mysql.c index 91e150f..7d85554 100644 --- a/plugins/check_mysql.c +++ b/plugins/check_mysql.c | |||
@@ -34,7 +34,7 @@ const char *progname = "check_mysql"; | |||
34 | const char *copyright = "1999-2011"; | 34 | const char *copyright = "1999-2011"; |
35 | const char *email = "devel@monitoring-plugins.org"; | 35 | const char *email = "devel@monitoring-plugins.org"; |
36 | 36 | ||
37 | #define SLAVERESULTSIZE 70 | 37 | #define SLAVERESULTSIZE 96 |
38 | 38 | ||
39 | #include "common.h" | 39 | #include "common.h" |
40 | #include "utils.h" | 40 | #include "utils.h" |
@@ -89,6 +89,8 @@ static const char *metric_counter[LENGTH_METRIC_COUNTER] = { | |||
89 | "Uptime" | 89 | "Uptime" |
90 | }; | 90 | }; |
91 | 91 | ||
92 | #define MYSQLDUMP_THREADS_QUERY "SELECT COUNT(1) mysqldumpThreads FROM information_schema.processlist WHERE info LIKE 'SELECT /*!40001 SQL_NO_CACHE */%'" | ||
93 | |||
92 | thresholds *my_threshold = NULL; | 94 | thresholds *my_threshold = NULL; |
93 | 95 | ||
94 | int process_arguments (int, char **); | 96 | int process_arguments (int, char **); |
@@ -108,7 +110,7 @@ main (int argc, char **argv) | |||
108 | 110 | ||
109 | char *result = NULL; | 111 | char *result = NULL; |
110 | char *error = NULL; | 112 | char *error = NULL; |
111 | char slaveresult[SLAVERESULTSIZE]; | 113 | char slaveresult[SLAVERESULTSIZE] = { 0 }; |
112 | char* perf; | 114 | char* perf; |
113 | 115 | ||
114 | perf = strdup (""); | 116 | perf = strdup (""); |
@@ -278,11 +280,30 @@ main (int argc, char **argv) | |||
278 | /* Save slave status in slaveresult */ | 280 | /* Save slave status in slaveresult */ |
279 | snprintf (slaveresult, SLAVERESULTSIZE, "Slave IO: %s Slave SQL: %s Seconds Behind Master: %s", row[slave_io_field], row[slave_sql_field], seconds_behind_field!=-1?row[seconds_behind_field]:"Unknown"); | 281 | snprintf (slaveresult, SLAVERESULTSIZE, "Slave IO: %s Slave SQL: %s Seconds Behind Master: %s", row[slave_io_field], row[slave_sql_field], seconds_behind_field!=-1?row[seconds_behind_field]:"Unknown"); |
280 | 282 | ||
281 | /* Raise critical error if SQL THREAD or IO THREAD are stopped */ | 283 | /* Raise critical error if SQL THREAD or IO THREAD are stopped, but only if there are no mysqldump threads running */ |
282 | if (strcmp (row[slave_io_field], "Yes") != 0 || strcmp (row[slave_sql_field], "Yes") != 0) { | 284 | if (strcmp (row[slave_io_field], "Yes") != 0 || strcmp (row[slave_sql_field], "Yes") != 0) { |
283 | mysql_free_result (res); | 285 | MYSQL_RES *res_mysqldump; |
284 | mysql_close (&mysql); | 286 | MYSQL_ROW row_mysqldump; |
285 | die (STATE_CRITICAL, "%s\n", slaveresult); | 287 | unsigned int mysqldump_threads = 0; |
288 | |||
289 | if (mysql_query (&mysql, MYSQLDUMP_THREADS_QUERY) == 0) { | ||
290 | /* store the result */ | ||
291 | if ( (res_mysqldump = mysql_store_result (&mysql)) != NULL) { | ||
292 | if (mysql_num_rows(res_mysqldump) == 1) { | ||
293 | if ( (row_mysqldump = mysql_fetch_row (res_mysqldump)) != NULL) { | ||
294 | mysqldump_threads = atoi(row_mysqldump[0]); | ||
295 | } | ||
296 | } | ||
297 | /* free the result */ | ||
298 | mysql_free_result (res_mysqldump); | ||
299 | } | ||
300 | mysql_close (&mysql); | ||
301 | } | ||
302 | if (mysqldump_threads == 0) { | ||
303 | die (STATE_CRITICAL, "%s\n", slaveresult); | ||
304 | } else { | ||
305 | strncat(slaveresult, " Mysqldump: in progress", SLAVERESULTSIZE-1); | ||
306 | } | ||
286 | } | 307 | } |
287 | 308 | ||
288 | if (verbose >=3) { | 309 | if (verbose >=3) { |
@@ -294,7 +315,7 @@ main (int argc, char **argv) | |||
294 | } | 315 | } |
295 | 316 | ||
296 | /* Check Seconds Behind against threshold */ | 317 | /* Check Seconds Behind against threshold */ |
297 | if ((seconds_behind_field != -1) && (strcmp (row[seconds_behind_field], "NULL") != 0)) { | 318 | if ((seconds_behind_field != -1) && (row[seconds_behind_field] != NULL && strcmp (row[seconds_behind_field], "NULL") != 0)) { |
298 | double value = atof(row[seconds_behind_field]); | 319 | double value = atof(row[seconds_behind_field]); |
299 | int status; | 320 | int status; |
300 | 321 | ||