[monitoring-plugins] More renaming due to MySQL name chances

Lorenz Kästle git at monitoring-plugins.org
Mon Oct 6 10:00:12 CEST 2025


 Module: monitoring-plugins
 Branch: master
 Commit: 392c945966d96d1dba9c68ac7a73450c2ad72d85
 Author: Lorenz Kästle <lorenz.kaestle at netways.de>
   Date: Tue Sep 30 14:51:39 2025 +0200
    URL: https://www.monitoring-plugins.org/repositories/monitoring-plugins/commit/?id=392c9459

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.

---

 plugins/check_mysql.c | 37 ++++++++++++++++++++++++++-----------
 1 file 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) {
 			num_fields = mysql_num_fields(res);
 			fields = mysql_fetch_fields(res);
 			for (int i = 0; i < num_fields; i++) {
-				if (strcmp(fields[i].name, "Slave_IO_Running") == 0) {
-					replica_io_field = i;
-					continue;
-				}
-				if (strcmp(fields[i].name, "Slave_SQL_Running") == 0) {
-					replica_sql_field = i;
-					continue;
-				}
-				if (strcmp(fields[i].name, "Seconds_Behind_Master") == 0) {
-					seconds_behind_field = i;
-					continue;
+				if (use_deprecated_slave_status) {
+					if (strcmp(fields[i].name, "Slave_IO_Running") == 0) {
+						replica_io_field = i;
+						continue;
+					}
+					if (strcmp(fields[i].name, "Slave_SQL_Running") == 0) {
+						replica_sql_field = i;
+						continue;
+					}
+					if (strcmp(fields[i].name, "Seconds_Behind_Master") == 0) {
+						seconds_behind_field = i;
+						continue;
+					}
+				} else {
+					if (strcmp(fields[i].name, "Replica_IO_Running") == 0) {
+						replica_io_field = i;
+						continue;
+					}
+					if (strcmp(fields[i].name, "Replica_SQL_Running") == 0) {
+						replica_sql_field = i;
+						continue;
+					}
+					if (strcmp(fields[i].name, "Seconds_Behind_Source") == 0) {
+						seconds_behind_field = i;
+						continue;
+					}
 				}
 			}
 



More information about the Commits mailing list