MySQL
Description
Monitors performance and operational metrics for a MySQL database.
Target
Typical platform: MySQL
Operating systems: Microsoft Windows, Linux
Prerequisites
Leverages: MySQL Database version 8.0 or higher
Technology and protocols: SQL/JDBC
Examples
CLI
metricshub HOSTNAME -t win -c +MySQL --jdbc -u USER --jdbc-url URL
metricshub.yaml
resourceGroups:
<RESOURCE_GROUP>:
resources:
<HOSTNAME-ID>:
attributes:
host.name: <HOSTNAME> # Change with actual host name
host.type: win
connectors: [ +MySQL ] # Optional, to load only this connector
protocols:
jdbc:
port: <PORT>
database: <DB_NAME>
type: <type>
url: <URL>
username: <USERNAME> # Change with actual credentials
password: <PASSWORD> # Encrypted using metricshub-encrypt
Connector Activation Criteria
The MySQL connector will be automatically activated, and its status will be reported as OK if all the below criteria are met:
- The SQL query below succeeds:
- Query:
SELECT @@version_comment REGEXP 'mysql' AS is_mysql; - Result contains:
1(regex)
- Query:
Metrics
| Type | Collected Metrics | Specific Attributes |
|---|---|---|
| mysql | db.server.cache.operations{db.io.direction="read", db.cache.state="hit", db.mysql.engine="innodb"}db.server.cache.operations{db.io.direction="read", db.cache.state="miss", db.mysql.engine="innodb"}db.server.cache.operations{db.io.direction="write", db.mysql.engine="innodb"}db.server.cache.read_ahead.operations{db.cache.read_ahead.state="random", db.mysql.engine="innodb"}db.server.cache.read_ahead{db.mysql.engine="innodb"}db.server.cache.read_head.evicted{db.mysql.engine="innodb"}db.server.cache.requests{db.cache.request.type="flushed", db.mysql.engine="innodb"}db.server.cache.usage{db.cache.state="data_clean", db.mysql.engine="innodb"}db.server.cache.usage{db.cache.state="data_dirty", db.mysql.engine="innodb"}db.server.cache.usage{db.cache.state="free", db.mysql.engine="innodb"}db.server.connections.limitdb.server.connections{db.connection.state="success"}db.server.connections{error.type="client_disconnected", db.connection.state="aborted"}db.server.connections{error.type="failed_attempt", db.connection.state="aborted"}db.server.current_connections{db.connection.state="active"}db.server.errors{error.type="lost_account_insert", db.mysql.engine="performance_schema"}db.server.errors{error.type="lost_condition_instrument", db.mysql.engine="performance_schema"}db.server.errors{error.type="lost_digest_instance", db.mysql.engine="performance_schema"}db.server.errors{error.type="lost_file_handle", db.mysql.engine="performance_schema"}db.server.errors{error.type="lost_file_instance", db.mysql.engine="performance_schema"}db.server.errors{error.type="lost_file_instrument", db.mysql.engine="performance_schema"}db.server.errors{error.type="lost_hosts_insert", db.mysql.engine="performance_schema"}db.server.errors{error.type="lost_index_statistic", db.mysql.engine="performance_schema"}db.server.errors{error.type="lost_locker", db.mysql.engine="performance_schema"}db.server.errors{error.type="lost_memory_instrument", db.mysql.engine="performance_schema"}db.server.errors{error.type="lost_metadata_lock", db.mysql.engine="performance_schema"}db.server.errors{error.type="lost_mutex_instance", db.mysql.engine="performance_schema"}db.server.errors{error.type="lost_mutex_instrument", db.mysql.engine="performance_schema"}db.server.files{db.file.state="open", db.mysql.engine="innodb"}db.server.io{db.io.direction="receive"}db.server.io{db.io.direction="transmit"}db.server.mysql.doublewrite_buffer.operations{db.mysql.engine="innodb"}db.server.mysql.doublewrite_buffer.usage{db.mysql.engine="innodb"}db.server.page.size{db.mysql.engine="innodb"}db.server.pending_operations{db.io.direction="read", db.mysql.engine="innodb"}db.server.pending_operations{db.io.direction="write", db.mysql.engine="innodb"}db.server.queries{db.query.state="failed", error.type="set_timeout_failed"}db.server.queries{db.query.state="failed", error.type="timeout"}db.server.queries{db.query.state="normal"}db.server.queries{db.query.state="slow"}db.server.row_lock.current_waits{db.mysql.engine="innodb"}db.server.row_lock.time{db.mysql.engine="innodb"}db.server.row_lock.waits{db.mysql.engine="innodb"}db.server.row_operations{db.row_operation.type="delete", db.mysql.engine="innodb"}db.server.row_operations{db.row_operation.type="insert", db.mysql.engine="innodb"}db.server.row_operations{db.row_operation.type="read", db.mysql.engine="innodb"}db.server.row_operations{db.row_operation.type="update", db.mysql.engine="innodb"}db.server.storage.io{db.io.direction="read", db.mysql.engine="innodb"}db.server.storage.io{db.io.direction="write", db.mysql.engine="innodb"}db.server.storage.operations{db.io.direction="read", db.mysql.engine="innodb"}db.server.storage.operations{db.io.direction="write", db.mysql.engine="innodb"}db.server.table_cache.operations{db.cache.state="hit"}db.server.table_cache.operations{db.cache.state="miss"}db.server.table_cache.operations{db.cache.state="overflow"}db.server.table_locks{db.lock.state="immediate"}db.server.table_locks{db.lock.state="waited"}db.server.tablesdb.server.temp_tables{db.temp_table.storage="disk"}db.server.temp_tables{db.temp_table.storage="memory"}db.server.threads{db.thread.state="cached"}db.server.threads{db.thread.state="connected"}db.server.threads{db.thread.state="created"}db.server.threads{db.thread.state="running"}db.server.uptime | db.namespacedb.server.namedb.server.portdb.systemdb.versionid |