From a7037b2f06c2528b0e43ac343b367c09b5f2bff6 Mon Sep 17 00:00:00 2001 From: Jan Wagner Date: Tue, 22 Apr 2025 16:31:14 +0200 Subject: [PATCH 01/10] New changelog --- debian/changelog | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/debian/changelog b/debian/changelog index 3a9b589..4119fa2 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,9 @@ +monitoring-plugins (2.4.0-4) UNRELEASED; urgency=medium + + * + + -- Jan Wagner Tue, 22 Apr 2025 16:31:05 +0200 + monitoring-plugins (2.4.0-3) unstable; urgency=medium * Upload to unstable From bee01b8716350afdcab7ce89d7a1aab9f9532f31 Mon Sep 17 00:00:00 2001 From: Jan Wagner Date: Tue, 22 Apr 2025 21:07:50 +0200 Subject: [PATCH 02/10] d/control: Remove Alexander Wirt from Uploaders --- debian/control | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/debian/control b/debian/control index 7b0f0c1..24c99cc 100644 --- a/debian/control +++ b/debian/control @@ -2,7 +2,7 @@ Source: monitoring-plugins Section: net Priority: optional Maintainer: Debian Nagios Maintainer Group -Uploaders: Jan Wagner , Alexander Wirt +Uploaders: Jan Wagner Build-Depends: debhelper-compat (= 13), libcurl4-openssl-dev | libcurl4-nss-dev | libcurl4-gnutls-dev, libdbi-dev, From 7236330ac9627804846774f39f3558c5680d20b2 Mon Sep 17 00:00:00 2001 From: Jan Wagner Date: Sun, 10 Aug 2025 23:09:45 +0200 Subject: [PATCH 03/10] d/control: Adding libsystemd-dev and libsystemd0 as build-dep (Closes: #1110265) --- debian/control | 2 ++ 1 file changed, 2 insertions(+) diff --git a/debian/control b/debian/control index 24c99cc..fb2c3c5 100644 --- a/debian/control +++ b/debian/control @@ -13,6 +13,8 @@ Build-Depends: debhelper-compat (= 13), libnet-snmp-perl, libpq-dev, libssl-dev, + libsystemd0, + libsystemd-dev, liburiparser-dev, mawk | awk, perl, From 8cd52e30e9f2c7e202c4b5d6681750de8397754d Mon Sep 17 00:00:00 2001 From: Jan Wagner Date: Mon, 11 Aug 2025 21:42:55 +0000 Subject: [PATCH 04/10] Adding d/patches/25_check_users_sd_get_uids to fix user count --- debian/patches/25_check_users_sd_get_uids | 28 +++++++++++++++++++++++ debian/patches/series | 1 + 2 files changed, 29 insertions(+) create mode 100644 debian/patches/25_check_users_sd_get_uids diff --git a/debian/patches/25_check_users_sd_get_uids b/debian/patches/25_check_users_sd_get_uids new file mode 100644 index 0000000..9f541ed --- /dev/null +++ b/debian/patches/25_check_users_sd_get_uids @@ -0,0 +1,28 @@ +From fb39f96ac6f72bb56d17f3e8694134dfea9186e9 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Lorenz=20K=C3=A4stle?= + <12514511+RincewindsHat@users.noreply.github.com> +Date: Mon, 11 Aug 2025 21:49:20 +0200 +Subject: [PATCH] check_users: Use sd_get_uids instead of sd_get_session + +Previously check_users in combination with systemd used +sd_get_sessions (3) to aquire the number of users, probably +with the idea that every users opens a session. +Turns out, that a user can have multiple sessions and we only really +want to know how many users there are. + +This commit changes to sd_get_uids (3) to achieve that target. +--- + plugins/check_users.d/users.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/plugins/check_users.c ++++ b/plugins/check_users.c +@@ -92,7 +92,7 @@ + + #ifdef HAVE_LIBSYSTEMD + if (sd_booted () > 0) +- users = sd_get_sessions (NULL); ++ users = sd_get_uids(NULL); + else { + #endif + #if HAVE_WTSAPI32_H diff --git a/debian/patches/series b/debian/patches/series index d349ff1..612f11a 100644 --- a/debian/patches/series +++ b/debian/patches/series @@ -17,4 +17,5 @@ 22_check_by_ssh_missing_options 23_sslutils_fix_error_message 24_check_http_deprecation +25_check_users_sd_get_uids # feature patches From 4770fe3039bd21031aea44449c3174910e95518d Mon Sep 17 00:00:00 2001 From: Bas Couwenberg Date: Fri, 12 Sep 2025 17:54:16 +0200 Subject: [PATCH 05/10] Update lintian overrides. --- debian/source/lintian-overrides | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 debian/source/lintian-overrides diff --git a/debian/source/lintian-overrides b/debian/source/lintian-overrides new file mode 100644 index 0000000..f4720ca --- /dev/null +++ b/debian/source/lintian-overrides @@ -0,0 +1,3 @@ +# Not supported by devscripts in trixie +older-debian-watch-file-standard 4 * + From 294841c2761d1a174615f382ae6511d33381349a Mon Sep 17 00:00:00 2001 From: Bas Couwenberg Date: Wed, 1 Oct 2025 09:41:52 +0200 Subject: [PATCH 06/10] Drop Priority: optional, default since dpkg 1.22.13. --- debian/control | 1 - 1 file changed, 1 deletion(-) diff --git a/debian/control b/debian/control index fb2c3c5..dfba624 100644 --- a/debian/control +++ b/debian/control @@ -1,6 +1,5 @@ Source: monitoring-plugins Section: net -Priority: optional Maintainer: Debian Nagios Maintainer Group Uploaders: Jan Wagner Build-Depends: debhelper-compat (= 13), From 97009f5d6d60efb073399cfc3e152e545846d887 Mon Sep 17 00:00:00 2001 From: Bas Couwenberg Date: Wed, 1 Oct 2025 11:16:13 +0200 Subject: [PATCH 07/10] Revert "Drop Priority: optional, default since dpkg 1.22.13." This reverts commit 294841c2761d1a174615f382ae6511d33381349a. --- debian/control | 1 + 1 file changed, 1 insertion(+) diff --git a/debian/control b/debian/control index dfba624..fb2c3c5 100644 --- a/debian/control +++ b/debian/control @@ -1,5 +1,6 @@ Source: monitoring-plugins Section: net +Priority: optional Maintainer: Debian Nagios Maintainer Group Uploaders: Jan Wagner Build-Depends: debhelper-compat (= 13), From 3f438f9cffa50d42359254c5afcd24e32513325f Mon Sep 17 00:00:00 2001 From: Jan Wagner Date: Thu, 25 Sep 2025 10:09:01 +0200 Subject: [PATCH 08/10] Adding d/p/26_check_mysql_replica from upstream (Closes: #1116027) --- debian/patches/26_check_mysql_replica | 188 ++++++++++++++++++++++++++ debian/patches/series | 1 + 2 files changed, 189 insertions(+) create mode 100644 debian/patches/26_check_mysql_replica diff --git a/debian/patches/26_check_mysql_replica b/debian/patches/26_check_mysql_replica new file mode 100644 index 0000000..aeeb45a --- /dev/null +++ b/debian/patches/26_check_mysql_replica @@ -0,0 +1,188 @@ +From 4886fa3debf79aa2faac9d0180e8ddb4bb1d4aaa Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Lorenz=20K=C3=A4stle?= + <12514511+RincewindsHat@users.noreply.github.com> +Date: Mon, 24 Feb 2025 19:52:08 +0100 +Subject: [PATCH 1/2] Add MySQL server version dectection and adaptive replica + query + +--- + +Taken from https://github.com/monitoring-plugins/monitoring-plugins/compare/master...maintenance-2.4.0-check_mysql.patch + +--- + plugins/check_mysql.c | 51 +++++++++++++++++++++++++++++++++++++++++-- + 1 file changed, 49 insertions(+), 2 deletions(-) + +diff --git a/plugins/check_mysql.c b/plugins/check_mysql.c +index 6a7daf11a..1b7403f7b 100644 +--- a/plugins/check_mysql.c ++++ b/plugins/check_mysql.c +@@ -211,8 +211,55 @@ main (int argc, char **argv) + } + + if(check_slave) { +- /* check the slave status */ +- if (mysql_query (&mysql, "show slave status") != 0) { ++ // Detect which version we are, on older version ++ // "show slave status" should work, on newer ones ++ // "show replica status" ++ // But first we have to find out whether this is ++ // MySQL or MariaDB since the version numbering scheme ++ // is different ++ bool use_deprecated_slave_status = false; ++ const char *server_version = mysql_get_server_info(&mysql); ++ unsigned long server_verion_int = mysql_get_server_version(&mysql); ++ unsigned long major_version = server_verion_int / 10000; ++ unsigned long minor_version = (server_verion_int % 10000) / 100; ++ unsigned long patch_version = (server_verion_int % 100); ++ if (verbose) { ++ printf("Found MariaDB: %s, main version: %lu, minor version: %lu, patch version: %lu\n", server_version, major_version, ++ minor_version, patch_version); ++ } ++ ++ if (strstr(server_version, "MariaDB") != NULL) { ++ // Looks like MariaDB, new commands should be available after 10.5.1 ++ if (major_version < 10) { ++ use_deprecated_slave_status = true; ++ } else if (major_version == 10) { ++ if (minor_version < 5) { ++ use_deprecated_slave_status = true; ++ } else if (minor_version == 5 && patch_version < 1) { ++ use_deprecated_slave_status = true; ++ } ++ } ++ } else if (strstr(server_version, "MySQL") != NULL) { ++ // Looks like MySQL ++ if (major_version < 8) { ++ use_deprecated_slave_status = true; ++ } else if (major_version == 10 && minor_version < 4) { ++ use_deprecated_slave_status = true; ++ } ++ } else { ++ printf("Not a known sever implementation: %s\n", server_version); ++ exit(STATE_UNKNOWN); ++ } ++ ++ char *replica_query = NULL; ++ if (use_deprecated_slave_status) { ++ replica_query = "show slave status"; ++ } else { ++ replica_query = "show replica status"; ++ } ++ ++ /* check the replica status */ ++ if (mysql_query(&mysql, replica_query) != 0) { + error = strdup(mysql_error(&mysql)); + mysql_close (&mysql); + die (STATE_CRITICAL, _("slave query error: %s\n"), error); + +From 291a704bcf738f6ceb7a1f46c69b8332b33dbd70 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Lorenz=20K=C3=A4stle?= + <12514511+RincewindsHat@users.noreply.github.com> +Date: Fri, 26 Sep 2025 08:57:19 +0200 +Subject: [PATCH 2/2] check_mysql: Assume MySQL server by default (in replica + check) + +In the Debian Bug tracker (and then Github) a person pointed out, +that a MySQL server does not respond with a hint that is indeed the +MySQL software, but only with the version string. +Which makes sense if one assumes to be the only implementation. + +This commit changes the behaviour of the Replica check to assume +that the counterpart is a MySQL server if there are not hints that +it is a MariaDB server. +--- + plugins/check_mysql.c | 7 ++----- + 1 file changed, 2 insertions(+), 5 deletions(-) + +diff --git a/plugins/check_mysql.c b/plugins/check_mysql.c +index 1b7403f7b..951a96f93 100644 +--- a/plugins/check_mysql.c ++++ b/plugins/check_mysql.c +@@ -239,16 +239,13 @@ main (int argc, char **argv) + use_deprecated_slave_status = true; + } + } +- } else if (strstr(server_version, "MySQL") != NULL) { +- // Looks like MySQL ++ } else { ++ // Looks like MySQL (or at least not like MariaDB) + if (major_version < 8) { + use_deprecated_slave_status = true; + } else if (major_version == 10 && minor_version < 4) { + use_deprecated_slave_status = true; + } +- } else { +- printf("Not a known sever implementation: %s\n", server_version); +- exit(STATE_UNKNOWN); + } + + char *replica_query = NULL; +From 392c945966d96d1dba9c68ac7a73450c2ad72d85 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Lorenz=20K=C3=A4stle?= +Date: Tue, 30 Sep 2025 14:51:39 +0200 +Subject: [PATCH] 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. + +--- + +Taken from https://patch-diff.githubusercontent.com/raw/monitoring-plugins/monitoring-plugins/pull/2163.patch + +--- + plugins/check_mysql.c | 37 ++++++++++++++++++++++++++----------- + 1 file changed, 26 insertions(+), 11 deletions(-) + +--- a/plugins/check_mysql.c ++++ b/plugins/check_mysql.c +@@ -300,17 +300,32 @@ + num_fields = mysql_num_fields(res); + fields = mysql_fetch_fields(res); + for(i = 0; i < num_fields; i++) { +- if (strcmp(fields[i].name, "Slave_IO_Running") == 0) { +- slave_io_field = i; +- continue; +- } +- if (strcmp(fields[i].name, "Slave_SQL_Running") == 0) { +- slave_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) { ++ slave_io_field = i; ++ continue; ++ } ++ if (strcmp(fields[i].name, "Slave_SQL_Running") == 0) { ++ slave_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) { ++ slave_io_field = i; ++ continue; ++ } ++ if (strcmp(fields[i].name, "Replica_SQL_Running") == 0) { ++ slave_sql_field = i; ++ continue; ++ } ++ if (strcmp(fields[i].name, "Seconds_Behind_Source") == 0) { ++ seconds_behind_field = i; ++ continue; ++ } + } + } + diff --git a/debian/patches/series b/debian/patches/series index 612f11a..f540ae3 100644 --- a/debian/patches/series +++ b/debian/patches/series @@ -18,4 +18,5 @@ 23_sslutils_fix_error_message 24_check_http_deprecation 25_check_users_sd_get_uids +26_check_mysql_replica # feature patches From 20d58b3cf9352b0f147439d6f2c0803ff7086d9d Mon Sep 17 00:00:00 2001 From: Jan Wagner Date: Mon, 6 Oct 2025 11:30:37 +0200 Subject: [PATCH 09/10] Prepare release --- debian/changelog | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/debian/changelog b/debian/changelog index 4119fa2..3885deb 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,8 +1,20 @@ -monitoring-plugins (2.4.0-4) UNRELEASED; urgency=medium +monitoring-plugins (2.4.0-4) unstable; urgency=medium - * + [ Jan Wagner ] + * [bee01b8] d/control: Remove Alexander Wirt from Uploaders + * [7236330] d/control: Adding libsystemd-dev and libsystemd0 as build-dep + (Closes: #1110265) + * [8cd52e3] Adding d/patches/25_check_users_sd_get_uids to fix user count - -- Jan Wagner Tue, 22 Apr 2025 16:31:05 +0200 + [ Bas Couwenberg ] + * [4770fe3] Update lintian overrides. + * [294841c] Drop Priority: optional, default since dpkg 1.22.13. + * [97009f5] Revert "Drop Priority: optional, default since dpkg 1.22.13." + + [ Jan Wagner ] + * [3f438f9] Adding d/p/26_check_mysql_replica from upstream (Closes: #1116027) + + -- Jan Wagner Mon, 06 Oct 2025 11:29:35 +0200 monitoring-plugins (2.4.0-3) unstable; urgency=medium From fc0af495f82fc43f80c6e3184678473a06667c19 Mon Sep 17 00:00:00 2001 From: Jan Wagner Date: Mon, 6 Oct 2025 12:04:55 +0200 Subject: [PATCH 10/10] New changelog --- debian/changelog | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/debian/changelog b/debian/changelog index 3885deb..5ff6e70 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,9 @@ +monitoring-plugins (2.4.0-5) UNRELEASED; urgency=medium + + * + + -- Jan Wagner Mon, 06 Oct 2025 12:04:34 +0200 + monitoring-plugins (2.4.0-4) unstable; urgency=medium [ Jan Wagner ]