MySQL / MariaDB
Common parts of every card are described in Monitor window.
| Detected by | systemd units mysql, mysqld, mariadb and their @ instances, or binaries mysqld, mariadbd |
| Read every | 60 s while the Monitor window shows the tab |
| Active probe | one login through the local socket with fixed read-only queries (off by default) |
| Test config | mysqld --validate-config (MySQL 8.0.16+) or mysqld --help --verbose (on demand) |
| Manual command | exact size of the data directory (du) |
What the card shows
Section titled “What the card shows”Passive:
- Server: variant and version from
--versionof the trusted server binary (only theVerline leaves the host) (only with the active probe: the passive read runs no binary of the service). - Process: running
mysqld/mariadbd(same PID namespace only) with--defaults-file,--datadir,--socket,--portfrom their command line. - Configuration from the option files, read by KryoDesk’s own reader (
!include/!includedir, the server groups, a closed list of options with checked values):datadir,Port,bind-address,skip-networking(no TCP, socket only),server-id, Binary log,read_only, Galera config. - File system of the data directory:
df: used of size, percent, free, device and mount point (the whole file system, not the database size). - Sockets: the server sockets with their owners, marked verified when the active probe may use them.
- Listening: TCP listeners on the watched ports (no TCP listener seen… when there is none or
ss/netstatis not available).
With the active probe on (otherwise Active probe off: connections, replication and Galera state need it.):
- Server (active probe): version as the server reports it, uptime, Connections (connected of
max_connections, orange from 75 %, red from 90 %),read_only. - Replication (n channels) (Not a replica (no replication channels). otherwise): per channel the
source host and port, GTID, IO and SQL thread running, seconds behind (
NULLwhen unknown), their states, and the last IO / SQL error with its number (the message cut beforeQuery:). - Galera / Cluster (
wsrep_*): this node, cluster size and state; on MySQL Group Replication the Members with role, state and version.
Active probe
Section titled “Active probe”Runs: one login as this SSH account’s own name through the local unix socket only
(--protocol=SOCKET), after checking the socket: owned by root or the server account (mysql,
User= of the unit), and /, every directory and link on the way owned by root or that account and
not writable by others (so never under /tmp). Client: mariadb (MariaDB) or mysql,
trusted and not setuid, with --no-defaults (no
~/.my.cnf, no option files), no login path file (MYSQL_TEST_LOGIN_FILE points nowhere),
MYSQL_PWD cleared: KryoDesk does not send a password; it works for an account without a password
or with unix_socket/auth_socket. --local-infile=0 (the server cannot ask the client for files of
this account), --connect-timeout=3 -B -n --force under timeout 5, fixed queries on stdin:
SELECT VERSION(), @@version_comment;SHOW GLOBAL STATUSandSHOW GLOBAL VARIABLESlimited to a fixed list (connections, uptime,read_only, Galerawsrep_*,datadir,port,socket);SHOW ALL SLAVES STATUS(MariaDB),SHOW REPLICA STATUS(MySQL 8.0.22+) orSHOW SLAVE STATUS;- on MySQL
performance_schema.replication_group_members.
The output is filtered on the host to closed lists of columns.
Traces on the host: one login per probe (every 60 s): with access a Connect/Quit in the general
log and in an audit plugin if enabled, Connections grows,
performance_schema.session_connect_attrs shows program_name=mysql/mariadb; without access an
Access denied entry in the error log (with log_error_verbosity=3), Aborted_connects grows and an
account with FAILED_LOGIN_ATTEMPTS may be locked. After a login error KryoDesk does not try again
until Retry; the card shows Login failed; the view is limited to the configuration with the raw
error.
Without a verified server socket: No verified server socket (see Sockets above): KryoDesk did not log in. Without a usable client on the host the view is limited to the configuration.
Test config
Section titled “Test config”The running server’s own binary (when trusted and run by the expected account), otherwise the unit’s
or a detected mariadbd/mysqld, with --defaults-file= / --defaults-extra-file= of the process or
the unit. Limit 30 s.
- MySQL / Percona 8.0.16+ confirmed by the probe:
mysqld --validate-config --log-error-verbosity=2: reads the option files like at startup, loads the plugin libraries they name (plugin-load-add), checks every server option and exits without starting the server; errors on stderr. - MariaDB and older MySQL:
mysqld --help --verbose: reads the option files like at startup, loads the plugin libraries they name and checks every option (an unknown or invalid one is an error, exit 7 on MariaDB), prints the resulting values (sent to/dev/nullhere: they may hold secrets), stats the data directory; does not start the server. Used because MariaDB and MySQL before 8.0.16 have no--validate-config(on MariaDB 10.6 that option is not rejected: the server starts).
For an instance unit (mysqld@x) --defaults-group-suffix is not passed: the test reads the default
groups ([mysqld], [server], …), not the instance’s own. The ownership check covers every option
file the probe found through includes.
Manual command
Section titled “Manual command”Exact size of the data directory: nice -n 19 timeout 600 du -sh -- <datadir> (default
/var/lib/mysql). Reads every file of the data directory (I/O load on large databases, under nice
and a 10-minute limit); needs read access to it (usually the mysql account or root).