Overview
OpenSRE uses MariaDB diagnostics to investigate database-related alerts — global status, process list, slow queries, InnoDB status, and replication. Operations are read-only.
Prerequisites
- MariaDB instance reachable from OpenSRE
- A user with monitoring privileges (
PROCESS, performance_schema / InnoDB status as needed)
Setup
Option 1: Interactive CLI
Option 2: Environment variables
Option 3: Persistent store
Add an active mariadb record to ~/.opensre/integrations.json with host, port, database, username, password, and ssl.
Credentials
Recommended user setup
Four notes on these grants, each confirmed against a real server:
information_schema needs no explicit grant — MariaDB exposes it automatically based on
a user’s other privileges. GRANT SELECT ON information_schema.* is rejected outright
(ERROR 1044) and aborts the script before later grants run.
- The grant on the target database (
MARIADB_DATABASE) is required — the connector
selects it as the default schema on connect, and without it every tool call fails with
Access denied ... to database.
- The replication-status tool (
SHOW ALL SLAVES STATUS) needs SLAVE MONITOR
— MySQL’s REPLICATION CLIENT name doesn’t carry the same privilege on MariaDB (SHOW GRANTS reports it back as BINLOG MONITOR, a related but different privilege that does
not cover replica status). Without it, that one tool fails with Access denied; you need (at least one of) the SLAVE MONITOR privilege(s) even though integrations verify mariadb and the other four tools pass. SLAVE MONITOR requires MariaDB 10.5.9+
(the privilege didn’t exist before then); on any older MariaDB, grant SUPER instead —
it has covered SHOW SLAVE STATUS across every MariaDB version.
- Slow queries need
performance_schema, which is enabled by default on the official
mariadb Docker image but often disabled in production my.cnf — check SELECT @@performance_schema if the slow-queries tool returns an empty note.
Quick local test with Docker
Like MySQL, the official MariaDB image starts a temporary init-only server before the
real one — its own log line reports port: 0. A readiness check against the socket (e.g.
mariadb-admin ping) can succeed against that temporary server and return moments before it
shuts down and the real server restarts, causing the very next command to fail with Access denied or a socket error. Waiting for the final server’s own log line (port: 3306) avoids
the race.
Verify:
opensre investigate (unlike opensre integrations verify) only falls through to env
vars when the store has no records at all — any existing record, for any service, blocks
env-var resolution entirely. Point OPENSRE_INTEGRATIONS_STORE_PATH at a path inside a
fresh empty directory instead, so your real config is never read or written and the
MARIADB_* vars above are the only source of connection info:
Trigger a real investigation against the seeded slow query:
Real output from a run against this exact local instance (edited for length). Another
integration resolved from your own env/keyring can ride along harmlessly, since the store
has no records to block fallback for any service:
All 5 registered tools were exercised in this single turn.
Teardown:
Verify
Troubleshooting
Security
- Use a dedicated read-only user.
- Keep TLS enabled (
MARIADB_SSL=true) in production.
- Store credentials out of source control.