summaryrefslogtreecommitdiffstats
path: root/plugins
diff options
context:
space:
mode:
authorLorenz Kästle <lorenz.kaestle@netways.de>2025-09-30 14:51:39 +0200
committerLorenz Kästle <lorenz.kaestle@netways.de>2025-09-30 14:51:45 +0200
commit392c945966d96d1dba9c68ac7a73450c2ad72d85 (patch)
tree7b4f9f64a2064c60076f69bdb51389f7ddd05c8d /plugins
parenta516b5e96e1b4dff0867d4ae3329b39d918a5a59 (diff)
downloadmonitoring-plugins-392c945966d96d1dba9c68ac7a73450c2ad72d85.tar.gz
More renaming due to MySQL name chances
Due to MySQL changing several term in Version 8.0.22 the way to determine the status of replicas has changed. To adapt to these changes in a517dc614e44650a7e9204c4202feec7a40fd37f check_mysql was modified to adapt to different versions. Some parts were missed though which results in failures to detect the replica status properly. This parts should be contained in this commit.
Diffstat (limited to 'plugins')
-rw-r--r--plugins/check_mysql.c37
1 files changed, 26 insertions, 11 deletions
diff --git a/plugins/check_mysql.c b/plugins/check_mysql.c
index 062ec657..6134d6c6 100644
--- a/plugins/check_mysql.c
+++ b/plugins/check_mysql.c
@@ -282,17 +282,32 @@ int main(int argc, char **argv) {
282 num_fields = mysql_num_fields(res); 282 num_fields = mysql_num_fields(res);
283 fields = mysql_fetch_fields(res); 283 fields = mysql_fetch_fields(res);
284 for (int i = 0; i < num_fields; i++) { 284 for (int i = 0; i < num_fields; i++) {
285 if (strcmp(fields[i].name, "Slave_IO_Running") == 0) { 285 if (use_deprecated_slave_status) {
286 replica_io_field = i; 286 if (strcmp(fields[i].name, "Slave_IO_Running") == 0) {
287 continue; 287 replica_io_field = i;
288 } 288 continue;
289 if (strcmp(fields[i].name, "Slave_SQL_Running") == 0) { 289 }
290 replica_sql_field = i; 290 if (strcmp(fields[i].name, "Slave_SQL_Running") == 0) {
291 continue; 291 replica_sql_field = i;
292 } 292 continue;
293 if (strcmp(fields[i].name, "Seconds_Behind_Master") == 0) { 293 }
294 seconds_behind_field = i; 294 if (strcmp(fields[i].name, "Seconds_Behind_Master") == 0) {
295 continue; 295 seconds_behind_field = i;
296 continue;
297 }
298 } else {
299 if (strcmp(fields[i].name, "Replica_IO_Running") == 0) {
300 replica_io_field = i;
301 continue;
302 }
303 if (strcmp(fields[i].name, "Replica_SQL_Running") == 0) {
304 replica_sql_field = i;
305 continue;
306 }
307 if (strcmp(fields[i].name, "Seconds_Behind_Source") == 0) {
308 seconds_behind_field = i;
309 continue;
310 }
296 } 311 }
297 } 312 }
298 313