MySQL / MariaDB
MySQL and MariaDB are widely used open-source relational database management systems.
Auto-Detection
Section titled “Auto-Detection”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_PASSWORDorMARIADB_ROOT_PASSWORD
If auto-detected parameters are incorrect, override them manually:
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: 3306EOFCreate or edit C:\ProgramData\glouton\conf.d\99-mysql.conf:
service: # For a MySQL or MariaDB running outside a container - type: "mysql" username: "USERNAME" password: "PASSWORD" address: "127.0.0.1" 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" port: 3307Glouton automatically detects configuration changes.
Built-in Metrics
Section titled “Built-in Metrics”| Metric | Description |
|---|---|
service_status | Status of MySQL or MariaDB |
mysql_cache_result_qcache_hits | Number of query cache hits per second |
mysql_cache_result_qcache_inserts | Number of queries added to the query cache per second |
mysql_cache_result_qcache_not_cached | Number of uncacheable queries per second |
mysql_cache_result_qcache_prunes | Number of queries deleted from the query cache due to low memory per second |
mysql_cache_blocksize_qcache | Number of blocks in the query cache |
mysql_cache_free_blocks | Number of free memory blocks in the query cache |
mysql_cache_free_memory | Free memory for the query cache in bytes |
mysql_cache_size_qcache | Number of queries registered in the query cache |
mysql_locks_immediate | Number of table locks granted immediately per second |
mysql_locks_waited | Number of table locks that required waiting per second |
mysql_innodb_history_list_len | Size of the InnoDB transaction history list |
mysql_innodb_locked_transaction | Number of currently locked InnoDB transactions |
mysql_octets_rx | Network traffic received from clients in bytes per second |
mysql_octets_tx | Network traffic sent to clients in bytes per second |
mysql_queries | Number of queries per second |
mysql_slow_queries | Number of slow queries per second |
mysql_threads_cached | Number of threads in the thread cache |
mysql_threads_connected | Number of currently open connections |
mysql_threads_running | Number of threads that are not sleeping |
mysql_total_threads_created | Number of threads created per second |
mysql_commands_begin | Number of "BEGIN" statements executed per second |
mysql_commands_binlog | Number of "BINLOG" statements executed per second |
mysql_commands_call_procedure | Number of "CALL PROCEDURE" statements executed per second |
mysql_commands_change_master | Number of "CHANGE MASTER" statements executed per second |
mysql_commands_change_repl_filter | Number of "CHANGE REPL FILTER" statements executed per second |
mysql_commands_check | Number of "CHECK TABLE" statements executed per second |
mysql_commands_checksum | Number of "CHECKSUM TABLE" statements executed per second |
mysql_commands_commit | Number of "COMMIT" statements executed per second |
mysql_commands_dealloc_sql | Number of "DEALLOCATE PREPARE" statements executed per second |
mysql_commands_stmt_close | Number of "DEALLOCATE PREPARE" statements executed per second |
mysql_commands_delete_multi | Number of multi-table "DELETE" statements executed per second |
mysql_commands_delete | Number of "DELETE" statements executed per second |
mysql_commands_do | Number of "DO" statements executed per second |
mysql_commands_execute_sql | Number of "EXECUTE" statements executed per second |
mysql_commands_stmt_execute | Number of "EXECUTE" statements executed per second |
mysql_commands_explain_other | Number of "EXPLAIN FOR CONNECTION" statements executed per second |
mysql_commands_flush | Number of "FLUSH" statements executed per second |
mysql_commands_ha_close | Number of "HA CLOSE" statements executed per second |
mysql_commands_ha_open | Number of "HA OPEN" statements executed per second |
mysql_commands_ha_read | Number of "HA READ" statements executed per second |
mysql_commands_insert_select | Number of "INSERT ... SELECT" statements executed per second |
mysql_commands_insert | Number of "INSERT" statements executed per second |
mysql_commands_kill | Number of "KILL" statements executed per second |
mysql_commands_preload_keys | Number of "LOAD INDEX INTO CACHE" statements executed per second |
mysql_commands_load | Number of "LOAD" statements executed per second |
mysql_commands_lock_tables | Number of "LOCK TABLES" statements executed per second |
mysql_commands_optimize | Number of "OPTIMIZE" statements executed per second |
mysql_commands_prepare_sql | Number of "PREPARE" statements executed per second |
mysql_commands_stmt_prepare | Number of "PREPARE" statements executed per second |
mysql_commands_purge_before_date | Number of "PURGE BEFORE DATE" statements executed per second |
mysql_commands_purge | Number of "PURGE" statements executed per second |
mysql_commands_release_savepoint | Number of "RELEASE SAVEPOINT" statements executed per second |
mysql_commands_repair | Number of "REPAIR" statements executed per second |
mysql_commands_replace_select | Number of "REPLACE SELECT" statements executed per second |
mysql_commands_replace | Number of "REPLACE" statements executed per second |
mysql_commands_reset | Number of "RESET" statements executed per second |
mysql_commands_resignal | Number of "RESIGNAL" statements executed per second |
mysql_commands_rollback_to_savepoint | Number of "ROLLBACK TO SAVEPOINT" statements executed per second |
mysql_commands_rollback | Number of "ROLLBACK" statements executed per second |
mysql_commands_savepoint | Number of "SAVEPOINT" statements executed per second |
mysql_commands_select | Number of "SELECT" statements executed per second |
mysql_commands_signal | Number of "SIGNAL" statements executed per second |
mysql_commands_slave_start | Number of "START SLAVE" statements executed per second |
mysql_commands_group_replication_start | Number of "START" for group replication statements executed per second |
mysql_commands_stmt_fetch | Number of "STMT FETCH" statements executed per second |
mysql_commands_stmt_reprepare | Number of "STMT REPREPARE" statements executed per second |
mysql_commands_stmt_reset | Number of "STMT RESET" statements executed per second |
mysql_commands_stmt_send_long_data | Number of "STMT SEND LONG DATA" statements executed per second |
mysql_commands_slave_stop | Number of "STOP SLAVE" statements executed per second |
mysql_commands_group_replication_stop | Number of "STOP" for group replication statements executed per second |
mysql_commands_truncate | Number of "TRUNCATE" statements executed per second |
mysql_commands_unlock_tables | Number of "UNLOCK TABLES" statements executed per second |
mysql_commands_update_multi | Number of multi-table "UPDATE" statements executed per second |
mysql_commands_update | Number of "UPDATE" statements executed per second |
mysql_commands_xa_commit | Number of "XA COMMIT" statements executed per second |
mysql_commands_xa_end | Number of "XA END" statements executed per second |
mysql_commands_xa_prepare | Number of "XA PREPARE" statements executed per second |
mysql_commands_xa_recover | Number of "XA RECOVER" statements executed per second |
mysql_commands_xa_rollback | Number of "XA ROLLBACK" statements executed per second |
mysql_commands_xa_start | Number of "XA START" statements executed per second |
mysql_commands_assign_to_keycache | Number of assign-to-keycache commands per second |
mysql_handler_commit | Number of internal commit requests per second |
mysql_handler_delete | Number of rows deleted from tables per second |
mysql_handler_write | Number of rows inserted per second |
mysql_handler_update | Number of rows updated per second |
mysql_handler_rollback | Number of transaction rollback requests given to a storage engine per second |
Glouton collects MySQL and MariaDB logs for analysis in Bleemeo.
Monitoring Troubleshooting
Section titled “Monitoring Troubleshooting”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 Service Check is not OK
Section titled “The Service Check is not OK”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.
Metrics are Missing
Section titled “Metrics are Missing”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:
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';