MySQL
Setup
To enable the Prometheus metric for MySQL you can use MySQL exporter Here. You can either run MySQL exporter using an environment variable or using the docker.
Using an environment variable
export DATA_SOURCE_NAME='user:password@(hostname:3306)/' ./mysqld_exporter <flags>
Using docker
docker network create my-mysql-network docker pull prom/mysqld-exporter
docker run -d -p 9104:9104 --network my-mysql-network -e DATA_SOURCE_NAME="user:password@(hostname:3306)/" prom/mysqld-exporter
Please refer to the exporter link above to enable flags in the exporter.
Verify the following metrics in the Prometheus to confirm the exporter is attached to the MySQL server properly.
mysql_version_info
mysql_global_status_connections
Metrics
Request and Errors
Metric | Key Performance Indicator (KPI) |
Request
| Request Rate
|
Error
| Error Ratio
|
Resource
Metric | Key Performance Indicator (KPI) |
Connections
| Connection Usage
|
Temp Tables Created
| Temp Tables Usage
|
Network Bytes Received
Network Bytes Transmitted
| Data transfer rate
|
Open Files
| Open Files Usage
|
Alerts
KPI | Alert |
Request Rate | RequestRateAnomaly |
Error Ratio | ErrorRatioBreach and ErrorBuildup based on an availability SLO of |
Connection Usage , Open Files Usage | Saturation with severity level of warning and critical when utilization exceeds 80% and 90% respectively |
Temp Tables Usage | ResourceRateAnomaly |
Network Bytes | ResourceRateAnomaly |
Failure Alerts
MySQLDown
MySQL is not Running
mysql_up != 1
MySqlRestarted
MySQL server restarted
mysql_global_status_uptime < 60
MySqlSlowQueries
MySQL queries are running slow
rate(mysql_global_status_sloq_queries[1m]) * 60 > 0
MysqlSlaveSqlThreadNotRunning
MySQL slave is not running though it is enabled
mysql_slave_status_master_server_id > 0 and on (instance, asserts_env, asserts_site) mysql_slave_status_slave_sql_running == 0
Dashboards
Following MySQL dashboard shows the Summary level metrics
Further details metrics are shown in the below dashboard
InnoDB Specific metrics are shown in the below dashboard
Last updated