MariaDB Monitoring
MariaDB-specific status variables and statistics tables, including Galera cluster health.
The InnoDB and query metrics in MySQL Monitoring apply. This page covers what is specific to MariaDB.
User and index statistics
MariaDB's userstat feature has no direct MySQL equivalent and is the easiest way to find unused
indexes and noisy clients:
userstat = 1-- Indexes never used since the last restart.
SELECT s.table_schema, s.table_name, s.index_name
FROM information_schema.statistics s
LEFT JOIN information_schema.index_statistics i
ON i.table_schema = s.table_schema
AND i.table_name = s.table_name
AND i.index_name = s.index_name
WHERE i.index_name IS NULL
AND s.table_schema NOT IN ('mysql','information_schema','performance_schema')
AND s.index_name <> 'PRIMARY';
-- Which clients generate the load.
SELECT user, total_connections, rows_read, rows_sent, busy_time
FROM information_schema.user_statistics ORDER BY busy_time DESC;
-- Which tables are actually read and written.
SELECT table_schema, table_name, rows_read, rows_changed
FROM information_schema.table_statistics ORDER BY rows_read DESC LIMIT 20;Galera cluster health
For a Galera deployment these are the metrics that matter most:
wsrep_cluster_status
Source: SHOW STATUS
Must be Primary. non-Primary means this node has lost quorum and is not serving.
wsrep_cluster_size
Source: SHOW STATUS
Number of members. Alert on any change — a silent drop from 3 to 2 removes your failure tolerance.
wsrep_local_state_comment
Source: SHOW STATUS
Should be Synced. Donor/Desynced or Joining means the node is transferring state and is
not serving normally.
wsrep_flow_control_paused
Source: SHOW STATUS
Fraction of time the cluster was throttled by a slow member. Sustained non-zero values mean one node is limiting everyone.
wsrep_local_recv_queue_avg
Source: SHOW STATUS
Average apply queue on this node. Consistently above zero identifies the lagging member.
wsrep_local_cert_failures
Source: SHOW STATUS
Certification conflicts. Rising values mean the same rows are being written from several nodes.
Slow query log
MariaDB adds detail levels the MySQL log does not have:
slow_query_log = 1
long_query_time = 0.5
log_slow_verbosity = query_plan,explainlog_slow_verbosity = explain records the query plan alongside the slow statement, which removes
the guesswork of reproducing it later.
Exporters
mysqld_exporter works with MariaDB, but some collectors query MySQL-specific tables and will fail
or return nothing. Verify each enabled collector against your MariaDB version, and add the Galera
status variables explicitly if you run a cluster. See
Prometheus Monitoring.