Skip to content

Add CheckMySQL module for MySQL, MariaDB and Percona servers - #1397

Merged
mickem merged 6 commits into
mainfrom
feature/add_mysql_check
Aug 13, 2026
Merged

Add CheckMySQL module for MySQL, MariaDB and Percona servers#1397
mickem merged 6 commits into
mainfrom
feature/add_mysql_check

Conversation

@mickem

@mickem mickem commented Aug 12, 2026

Copy link
Copy Markdown
Owner

New cross-platform check module built on MariaDB Connector/C (LGPL), which speaks the native protocol to the whole MySQL family:

  • check_mysql: connectivity/health with version, flavor (mysql/mariadb/ percona), uptime (time-unit thresholds) and connection-pool keywords. Connection failures are UNKNOWN with the driver's error message.
  • check_mysql_query: arbitrary SQL with result columns registered as filter keywords (CheckWMI-style), per-row matching and perf data via perf-syntax.

The module is optional: it builds when the connector is found (FindMariaDB, libmariadb-dev or -DMARIADB_ROOT_DIR) and is skipped with a clear reason otherwise. Only mysql_session.cpp touches the connector; the checks consume an injectable session factory, so the unit tests run without libmariadb.

Notable behaviour: TCP is forced unless socket= is given (the connector silently turns host=localhost into a socket connection), and plugin-dir= supports MySQL 8's caching_sha2_password auth plugin from non-default locations. Verified live against MariaDB 11 and MySQL 8.4; the integration suite starts a MariaDB testcontainer and skips itself without docker or without the module built. MSI entries are present but commented until the connector is part of the Windows build dependencies.

Assisted-by: Claude Code:claude-fable-5

New cross-platform check module built on MariaDB Connector/C (LGPL), which
speaks the native protocol to the whole MySQL family:

- check_mysql: connectivity/health with version, flavor (mysql/mariadb/
  percona), uptime (time-unit thresholds) and connection-pool keywords.
  Connection failures are UNKNOWN with the driver's error message.
- check_mysql_query: arbitrary SQL with result columns registered as filter
  keywords (CheckWMI-style), per-row matching and perf data via perf-syntax.

The module is optional: it builds when the connector is found (FindMariaDB,
libmariadb-dev or -DMARIADB_ROOT_DIR) and is skipped with a clear reason
otherwise. Only mysql_session.cpp touches the connector; the checks consume
an injectable session factory, so the unit tests run without libmariadb.

Notable behaviour: TCP is forced unless socket= is given (the connector
silently turns host=localhost into a socket connection), and plugin-dir=
supports MySQL 8's caching_sha2_password auth plugin from non-default
locations. Verified live against MariaDB 11 and MySQL 8.4; the integration
suite starts a MariaDB testcontainer and skips itself without docker or
without the module built. MSI entries are present but commented until the
connector is part of the Windows build dependencies.

Assisted-by: Claude Code:claude-fable-5
Signed-off-by: Michael Medin <michael@medin.name>
@mickem
mickem requested a balanced review from Copilot August 12, 2026 08:17
@Fantu

Fantu commented Aug 12, 2026

Copy link
Copy Markdown
Contributor

Thanks for this other useful addition.
I'll need it on Linux, but unfortunately I haven't had time to continue work on nscp on linux, and I don't think I can even do it these days.
I'm currently trying to add and improve the Windows device monitoring, which is the most problematic. Lately, several issues have been costing me a lot of time debugging, so I'm trying to add checks that will help detect some difficult cases.
When I'll have a bit of peace, I'll get back to focusing on the Linux monitoring. Even though the problems are rarer and often easier/quicker to resolve on linux, monitoring is still useful. I'm already using icinga2 monitoring on Linux, but with other tools. The ultimate goal in the future would be to use nscp with icinga push passive checks on all Windows and Linux systems.

mickem added 5 commits August 12, 2026 18:07
Signed-off-by: Michael Medin <michael@medin.name>
Signed-off-by: Michael Medin <michael@medin.name>
The Windows builds failed while compiling MariaDB Connector/C: schannel.c
could not find SCH_CREDENTIALS / TLS_PARAMETERS and both schannel.c and
ma_schannel.c could not find SP_PROT_TLS1_3_CLIENT.

CMake picked the wrong SDK for the connector: the log shows "Selecting
Windows SDK version 8.1 to target Windows 6.2.9200". The runner has the
Windows 8.1 SDK installed for the legacy XP/cryptopp build path and
reports itself as 6.2, so that is what CMake defaults to - and the 8.1
headers predate the Schannel TLS 1.3 credential structures the connector
now uses.

Pass CMAKE_SYSTEM_VERSION=10.0 when configuring the connector so CMake
selects the newest installed Windows 10 SDK. Only the SDK changes; the
toolset stays whatever the caller asked for (v141 on x86/x64, v143 on
arm64).

Assisted-by: Claude Code
Signed-off-by: Michael Medin <michael@medin.name>
The previous attempt did not take: unquoted, PowerShell splits
-DCMAKE_SYSTEM_VERSION=10.0 into "-DCMAKE_SYSTEM_VERSION=10" plus a stray
".0" positional. CMake took the truncated value ("Ignoring extra path
from command line: .0", "TLS library/version: Schannel 10"), did not
recognise it as a Windows 10 SDK request and fell back to 8.1 again, so
the Schannel sources failed exactly as before.

Quote the argument, and assert on the WindowsTargetPlatformVersion CMake
wrote into the generated project afterwards, so any future fallback to
the 8.1 SDK fails with one clear line instead of forty compiler errors.

Assisted-by: Claude Code
Signed-off-by: Michael Medin <michael@medin.name>
Signed-off-by: Michael Medin <michael@medin.name>
@mickem
mickem merged commit 309b93b into main Aug 13, 2026
46 of 48 checks passed
@mickem
mickem deleted the feature/add_mysql_check branch August 13, 2026 04:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants