Skip to content
BleemeoBleemeo

MySQL / MariaDB

Auto-Detection
Built-in Metrics
Logs
Tutorial availableHow to use Bleemeo for a MySQL monitoring
Read the tutorial

MySQL and MariaDB are widely used open-source relational database management systems.

Glouton detects MySQL and MariaDB by their process and listening port (default: 3306).

To enable metrics gathering, credentials are required. Glouton finds them automatically if:

  • MySQL or MariaDB and the agent are running on Ubuntu or Debian
  • MySQL or MariaDB is running in a Docker container with the root password set through the environment variable MYSQL_ROOT_PASSWORD or MARIADB_ROOT_PASSWORD

If auto-detected parameters are incorrect, override them manually:

Terminal window
sudo tee /etc/glouton/conf.d/99-mysql.conf > /dev/null << 'EOF'
service:
# For a MySQL or MariaDB running outside a container
- type: "mysql"
username: "USERNAME"
password: "PASSWORD"
address: "127.0.0.1"
# If set to an existing socket file, Glouton will prefer the Unix socket
# for gathering metrics. Service check will continue to use the TCP address.
metrics_unix_socket: "/var/run/mysqld/mysqld.sock"
port: 3306
# For an additional MySQL or MariaDB running outside a container
- type: "mysql"
instance: "NAME_ASSOCIATED_WITH_YOUR_ADDITIONAL_SERVICE"
username: "USERNAME"
password: "PASSWORD"
address: "127.0.0.1"
metrics_unix_socket: "/var/run/mysqld/mysqld2.sock"
port: 3307
# For a MySQL or MariaDB running in a Docker container
- type: "mysql"
instance: "CONTAINER_NAME"
username: "USERNAME"
password: "PASSWORD"
address: "172.17.0.2"
port: 3306
EOF

Glouton automatically detects configuration changes.

MetricDescription
service_statusStatus of MySQL or MariaDB
mysql_cache_result_qcache_hitsNumber of query cache hits per second
mysql_cache_result_qcache_insertsNumber of queries added to the query cache per second
mysql_cache_result_qcache_not_cachedNumber of uncacheable queries per second
mysql_cache_result_qcache_prunesNumber of queries deleted from the query cache due to low memory per second
mysql_cache_blocksize_qcacheNumber of blocks in the query cache
mysql_cache_free_blocksNumber of free memory blocks in the query cache
mysql_cache_free_memoryFree memory for the query cache in bytes
mysql_cache_size_qcacheNumber of queries registered in the query cache
mysql_locks_immediateNumber of table locks granted immediately per second
mysql_locks_waitedNumber of table locks that required waiting per second
mysql_innodb_history_list_lenSize of the InnoDB transaction history list
mysql_innodb_locked_transactionNumber of currently locked InnoDB transactions
mysql_octets_rxNetwork traffic received from clients in bytes per second
mysql_octets_txNetwork traffic sent to clients in bytes per second
mysql_queriesNumber of queries per second
mysql_slow_queriesNumber of slow queries per second
mysql_threads_cachedNumber of threads in the thread cache
mysql_threads_connectedNumber of currently open connections
mysql_threads_runningNumber of threads that are not sleeping
mysql_total_threads_createdNumber of threads created per second
mysql_commands_beginNumber of "BEGIN" statements executed per second
mysql_commands_binlogNumber of "BINLOG" statements executed per second
mysql_commands_call_procedureNumber of "CALL PROCEDURE" statements executed per second
mysql_commands_change_masterNumber of "CHANGE MASTER" statements executed per second
mysql_commands_change_repl_filterNumber of "CHANGE REPL FILTER" statements executed per second
mysql_commands_checkNumber of "CHECK TABLE" statements executed per second
mysql_commands_checksumNumber of "CHECKSUM TABLE" statements executed per second
mysql_commands_commitNumber of "COMMIT" statements executed per second
mysql_commands_dealloc_sqlNumber of "DEALLOCATE PREPARE" statements executed per second
mysql_commands_stmt_closeNumber of "DEALLOCATE PREPARE" statements executed per second
mysql_commands_delete_multiNumber of multi-table "DELETE" statements executed per second
mysql_commands_deleteNumber of "DELETE" statements executed per second
mysql_commands_doNumber of "DO" statements executed per second
mysql_commands_execute_sqlNumber of "EXECUTE" statements executed per second
mysql_commands_stmt_executeNumber of "EXECUTE" statements executed per second
mysql_commands_explain_otherNumber of "EXPLAIN FOR CONNECTION" statements executed per second
mysql_commands_flushNumber of "FLUSH" statements executed per second
mysql_commands_ha_closeNumber of "HA CLOSE" statements executed per second
mysql_commands_ha_openNumber of "HA OPEN" statements executed per second
mysql_commands_ha_readNumber of "HA READ" statements executed per second
mysql_commands_insert_selectNumber of "INSERT ... SELECT" statements executed per second
mysql_commands_insertNumber of "INSERT" statements executed per second
mysql_commands_killNumber of "KILL" statements executed per second
mysql_commands_preload_keysNumber of "LOAD INDEX INTO CACHE" statements executed per second
mysql_commands_loadNumber of "LOAD" statements executed per second
mysql_commands_lock_tablesNumber of "LOCK TABLES" statements executed per second
mysql_commands_optimizeNumber of "OPTIMIZE" statements executed per second
mysql_commands_prepare_sqlNumber of "PREPARE" statements executed per second
mysql_commands_stmt_prepareNumber of "PREPARE" statements executed per second
mysql_commands_purge_before_dateNumber of "PURGE BEFORE DATE" statements executed per second
mysql_commands_purgeNumber of "PURGE" statements executed per second
mysql_commands_release_savepointNumber of "RELEASE SAVEPOINT" statements executed per second
mysql_commands_repairNumber of "REPAIR" statements executed per second
mysql_commands_replace_selectNumber of "REPLACE SELECT" statements executed per second
mysql_commands_replaceNumber of "REPLACE" statements executed per second
mysql_commands_resetNumber of "RESET" statements executed per second
mysql_commands_resignalNumber of "RESIGNAL" statements executed per second
mysql_commands_rollback_to_savepointNumber of "ROLLBACK TO SAVEPOINT" statements executed per second
mysql_commands_rollbackNumber of "ROLLBACK" statements executed per second
mysql_commands_savepointNumber of "SAVEPOINT" statements executed per second
mysql_commands_selectNumber of "SELECT" statements executed per second
mysql_commands_signalNumber of "SIGNAL" statements executed per second
mysql_commands_slave_startNumber of "START SLAVE" statements executed per second
mysql_commands_group_replication_startNumber of "START" for group replication statements executed per second
mysql_commands_stmt_fetchNumber of "STMT FETCH" statements executed per second
mysql_commands_stmt_reprepareNumber of "STMT REPREPARE" statements executed per second
mysql_commands_stmt_resetNumber of "STMT RESET" statements executed per second
mysql_commands_stmt_send_long_dataNumber of "STMT SEND LONG DATA" statements executed per second
mysql_commands_slave_stopNumber of "STOP SLAVE" statements executed per second
mysql_commands_group_replication_stopNumber of "STOP" for group replication statements executed per second
mysql_commands_truncateNumber of "TRUNCATE" statements executed per second
mysql_commands_unlock_tablesNumber of "UNLOCK TABLES" statements executed per second
mysql_commands_update_multiNumber of multi-table "UPDATE" statements executed per second
mysql_commands_updateNumber of "UPDATE" statements executed per second
mysql_commands_xa_commitNumber of "XA COMMIT" statements executed per second
mysql_commands_xa_endNumber of "XA END" statements executed per second
mysql_commands_xa_prepareNumber of "XA PREPARE" statements executed per second
mysql_commands_xa_recoverNumber of "XA RECOVER" statements executed per second
mysql_commands_xa_rollbackNumber of "XA ROLLBACK" statements executed per second
mysql_commands_xa_startNumber of "XA START" statements executed per second
mysql_commands_assign_to_keycacheNumber of assign-to-keycache commands per second
mysql_handler_commitNumber of internal commit requests per second
mysql_handler_deleteNumber of rows deleted from tables per second
mysql_handler_writeNumber of rows inserted per second
mysql_handler_updateNumber of rows updated per second
mysql_handler_rollbackNumber of transaction rollback requests given to a storage engine per second

Glouton collects MySQL and MariaDB logs for analysis in Bleemeo.

See Troubleshoot a Service Check or Missing Metrics for what applies to every service: finding the address and port Glouton really uses, what each check message means, and how to read the collection error — which does not appear in the agent logs at the default level.

The check only opens the TCP port — it sends no query — so it fails for one of three reasons:

Status text Cause Fix
TCP port 3306, Connection refused The server listens on another port, or not on TCP at all: skip-networking, or a bind-address that excludes the address Glouton uses Set address and port, or allow TCP connections from the agent
TCP port N, connection timed out after 10 seconds A firewall drops the packets Open the port for the agent
Invalid TCP address "..." A typo in the Glouton configuration Fix the configuration

A MySQL reachable only through its UNIX socket cannot be checked: the check always uses TCP, and metrics_unix_socket covers the metrics only.

A passing check says nothing about the metrics: they are collected separately.

Glouton needs a password to gather anything at all — without one it creates no MySQL collector, and only service_status is reported. The user defaults to root, and Glouton also picks up credentials from /etc/mysql/debian.cnf outside containers, or from MYSQL_ROOT_PASSWORD / MARIADB_ROOT_PASSWORD inside one.

With credentials in place, it runs SHOW GLOBAL STATUS, SHOW GLOBAL VARIABLES and reads information_schema.INNODB_METRICS.

Reproduce what Glouton does, from the machine where the agent runs:

Terminal window
mysql -h 127.0.0.1 -P 3306 -u glouton -p -e "SHOW GLOBAL STATUS LIKE 'Queries'; SELECT COUNT(*) FROM information_schema.INNODB_METRICS"
What you see Cause Fix
nothing — the collector is never created No password configured Set password in the Glouton configuration
Access denied for user '...'@'...' Wrong credentials Fix username and password
Access denied for user 'root'@'127.0.0.1' — connecting over TCP is not the same host as connecting over the socket The user exists for localhost only Grant the user for the address the agent uses, or point Glouton at the socket with metrics_unix_socket
Access denied on every password attempt The user authenticates with auth_socket — the default for root on Debian and Ubuntu Create a dedicated monitoring user with a password
an error on information_schema.INNODB_METRICS Missing PROCESS privilege Grant it: the mysql_innodb_* metrics need it, the others do not — this is the usual cause of some metrics missing
a connection error The server requires TLS (require_secure_transport) Allow non-TLS connections from the agent address

A minimal monitoring user:

CREATE USER 'glouton'@'127.0.0.1' IDENTIFIED BY 'PASSWORD';
GRANT PROCESS ON *.* TO 'glouton'@'127.0.0.1';