MySQL instance is down on {{ $labels.instance }}
# 1m delay allows a restart without triggering an alert.
- alert: MysqlDown
expr: 'mysql_up == 0'
for: 1m
labels:
severity: critical
annotations:
summary: MySQL down (instance {{ $labels.instance }})
description: "MySQL instance is down on {{ $labels.instance }}\n VALUE = {{ $value }}\n LABELS = {{ $labels }}"critical
2.1.2.MySQL Slave IO thread not running
MySQL Slave IO thread not running on {{ $labels.instance }}
# 1m delay allows a restart without triggering an alert.
- alert: MysqlSlaveIoThreadNotRunning
expr: '( mysql_slave_status_slave_io_running and ON (instance) mysql_slave_status_master_server_id > 0 ) == 0'
for: 1m
labels:
severity: critical
annotations:
summary: MySQL Slave IO thread not running (instance {{ $labels.instance }})
description: "MySQL Slave IO thread not running on {{ $labels.instance }}\n VALUE = {{ $value }}\n LABELS = {{ $labels }}"critical
2.1.3.MySQL Slave SQL thread not running
MySQL Slave SQL thread not running on {{ $labels.instance }}
# 1m delay allows a restart without triggering an alert.
- alert: MysqlSlaveSqlThreadNotRunning
expr: '( mysql_slave_status_slave_sql_running and ON (instance) mysql_slave_status_master_server_id > 0) == 0'
for: 1m
labels:
severity: critical
annotations:
summary: MySQL Slave SQL thread not running (instance {{ $labels.instance }})
description: "MySQL Slave SQL thread not running on {{ $labels.instance }}\n VALUE = {{ $value }}\n LABELS = {{ $labels }}"warning
2.1.4.MySQL too many connections (> 80%)
More than 80% of MySQL connections are in use on {{ $labels.instance }}
- alert: MysqlTooManyConnections(>80%)
expr: 'max_over_time(mysql_global_status_threads_connected[1m]) / mysql_global_variables_max_connections * 100 > 80 and mysql_global_variables_max_connections > 0'
for: 2m
labels:
severity: warning
annotations:
summary: MySQL too many connections (> 80%) (instance {{ $labels.instance }})
description: "More than 80% of MySQL connections are in use on {{ $labels.instance }}\n VALUE = {{ $value }}\n LABELS = {{ $labels }}"warning
2.1.5.MySQL high prepared statements utilization (> 80%)
High utilization of prepared statements (>80%) on {{ $labels.instance }}
- alert: MysqlHighPreparedStatementsUtilization(>80%)
expr: 'max_over_time(mysql_global_status_prepared_stmt_count[1m]) / mysql_global_variables_max_prepared_stmt_count * 100 > 80 and mysql_global_variables_max_prepared_stmt_count > 0'
for: 2m
labels:
severity: warning
annotations:
summary: MySQL high prepared statements utilization (> 80%) (instance {{ $labels.instance }})
description: "High utilization of prepared statements (>80%) on {{ $labels.instance }}\n VALUE = {{ $value }}\n LABELS = {{ $labels }}"warning
2.1.6.MySQL high threads running
More than 60% of MySQL connections are in running state on {{ $labels.instance }}
- alert: MysqlHighThreadsRunning
expr: 'max_over_time(mysql_global_status_threads_running[1m]) / mysql_global_variables_max_connections * 100 > 60 and mysql_global_variables_max_connections > 0'
for: 2m
labels:
severity: warning
annotations:
summary: MySQL high threads running (instance {{ $labels.instance }})
description: "More than 60% of MySQL connections are in running state on {{ $labels.instance }}\n VALUE = {{ $value }}\n LABELS = {{ $labels }}"critical
2.1.7.MySQL Slave replication lag
MySQL replication lag on {{ $labels.instance }}
- alert: MysqlSlaveReplicationLag
expr: '( (mysql_slave_status_seconds_behind_master - mysql_slave_status_sql_delay) and ON (instance) mysql_slave_status_master_server_id > 0 ) > 30'
for: 1m
labels:
severity: critical
annotations:
summary: MySQL Slave replication lag (instance {{ $labels.instance }})
description: "MySQL replication lag on {{ $labels.instance }}\n VALUE = {{ $value }}\n LABELS = {{ $labels }}"critical
2.1.8.MySQL heartbeat replication lag
MySQL replication lag on {{ $labels.instance }}
# More reliable than seconds_behind_master since it measures actual wall-clock lag rather
# than a value that can freeze during long-running statements. Requires mysqld_exporter's
# optional --collect.heartbeat flag and a pt-heartbeat-style heartbeat table.
- alert: MysqlHeartbeatReplicationLag
expr: 'mysql_heartbeat_now_timestamp_seconds - mysql_heartbeat_stored_timestamp_seconds > 30'
for: 1m
labels:
severity: critical
annotations:
summary: MySQL heartbeat replication lag (instance {{ $labels.instance }})
description: "MySQL replication lag on {{ $labels.instance }}\n VALUE = {{ $value }}\n LABELS = {{ $labels }}"critical
2.1.9.MySQL Galera node not ready
Galera cluster node {{ $labels.instance }} is not ready and is not accepting reads or writes.
- alert: MysqlGaleraNodeNotReady
expr: 'mysql_global_status_wsrep_ready != 1'
for: 1m
labels:
severity: critical
annotations:
summary: MySQL Galera node not ready (instance {{ $labels.instance }})
description: "Galera cluster node {{ $labels.instance }} is not ready and is not accepting reads or writes.\n VALUE = {{ $value }}\n LABELS = {{ $labels }}"warning
2.1.10.MySQL slow queries
MySQL server has some new slow queries ({{ $value }} in the last minute).
- alert: MysqlSlowQueries
expr: 'increase(mysql_global_status_slow_queries[1m]) > 0'
for: 2m
labels:
severity: warning
annotations:
summary: MySQL slow queries (instance {{ $labels.instance }})
description: "MySQL server has some new slow queries ({{ $value }} in the last minute).\n VALUE = {{ $value }}\n LABELS = {{ $labels }}"warning
2.1.11.MySQL InnoDB log waits
MySQL innodb log writes stalling ({{ $value }} waits/s)
# 10 waits/s is a rough default; log-write stalls scale with your write workload and innodb_log_buffer_size — adjust based on your workload and buffer size.
- alert: MysqlInnodbLogWaits
expr: 'rate(mysql_global_status_innodb_log_waits[15m]) > 10'
for: 0m
labels:
severity: warning
annotations:
summary: MySQL InnoDB log waits (instance {{ $labels.instance }})
description: "MySQL innodb log writes stalling ({{ $value }} waits/s)\n VALUE = {{ $value }}\n LABELS = {{ $labels }}"warning
2.1.12.MySQL too many open files
MySQL has too many open files, consider increase variables open_files_limit on {{ $labels.instance }}.
- alert: MysqlTooManyOpenFiles
expr: 'mysql_global_status_innodb_num_open_files / mysql_global_variables_open_files_limit * 100 > 75 and mysql_global_variables_open_files_limit > 0'
for: 2m
labels:
severity: warning
annotations:
summary: MySQL too many open files (instance {{ $labels.instance }})
description: "MySQL has too many open files, consider increase variables open_files_limit on {{ $labels.instance }}.\n VALUE = {{ $value }}\n LABELS = {{ $labels }}"warning
2.1.13.MySQL InnoDB history_len too long
MySQL history_len (undo log) too long on {{ $labels.instance }}
# 50000 is a rough default; undo log length grows with long-running transactions and write volume — adjust based on your transaction patterns.
- alert: MysqlInnodbHistory_lenTooLong
expr: 'mysql_info_schema_innodb_metrics_transaction_trx_rseg_history_len > 50000'
for: 2m
labels:
severity: warning
annotations:
summary: MySQL InnoDB history_len too long (instance {{ $labels.instance }})
description: "MySQL history_len (undo log) too long on {{ $labels.instance }}\n VALUE = {{ $value }}\n LABELS = {{ $labels }}"warning
2.1.14.MySQL Galera donor falling behind
Galera donor node {{ $labels.instance }} serving a state transfer has a growing receive queue ({{ $value }} entries), indicating it is falling behind the rest of the cluster.
# 100-entry queue is a rough default; catch-up speed depends on your cluster's write throughput and network bandwidth — adjust based on your workload.
- alert: MysqlGaleraDonorFallingBehind
expr: 'mysql_global_status_wsrep_local_state == 2 and mysql_global_status_wsrep_local_recv_queue > 100'
for: 2m
labels:
severity: warning
annotations:
summary: MySQL Galera donor falling behind (instance {{ $labels.instance }})
description: "Galera donor node {{ $labels.instance }} serving a state transfer has a growing receive queue ({{ $value }} entries), indicating it is falling behind the rest of the cluster.\n VALUE = {{ $value }}\n LABELS = {{ $labels }}"info
2.1.15.MySQL restarted
MySQL has just been restarted, less than one minute ago on {{ $labels.instance }}.
- alert: MysqlRestarted
expr: 'mysql_global_status_uptime < 60'
for: 0m
labels:
severity: info
annotations:
summary: MySQL restarted (instance {{ $labels.instance }})
description: "MySQL has just been restarted, less than one minute ago on {{ $labels.instance }}.\n VALUE = {{ $value }}\n LABELS = {{ $labels }}"info
2.1.16.MySQL High QPS
MySQL is being overload with unusual QPS (> 10k QPS).
# 10k QPS is a rough default; normal query volume scales with your application traffic — adjust based on your baseline.
- alert: MysqlHighQps
expr: 'rate(mysql_global_status_questions[1m]) > 10000'
for: 2m
labels:
severity: info
annotations:
summary: MySQL High QPS (instance {{ $labels.instance }})
description: "MySQL is being overload with unusual QPS (> 10k QPS).\n VALUE = {{ $value }}\n LABELS = {{ $labels }}"warning
2.1.17.MySQL Galera node out of sync
Galera node {{ $labels.instance }} has unexpectedly fallen out of the Synced state (wsrep_local_state != 4), excluding nodes intentionally desynced for a state transfer or backup.
- alert: MysqlGaleraNodeOutOfSync
expr: 'mysql_global_status_wsrep_local_state != 4 and mysql_global_variables_wsrep_desync == 0'
for: 2m
labels:
severity: warning
annotations:
summary: MySQL Galera node out of sync (instance {{ $labels.instance }})
description: "Galera node {{ $labels.instance }} has unexpectedly fallen out of the Synced state (wsrep_local_state != 4), excluding nodes intentionally desynced for a state transfer or backup.\n VALUE = {{ $value }}\n LABELS = {{ $labels }}"warning
2.1.18.MySQL InnoDB Force Recovery is enabled
MySQL InnoDB force recovery is enabled on {{ $labels.instance }}
- alert: MysqlInnodbForceRecoveryIsEnabled
expr: 'mysql_global_variables_innodb_force_recovery != 0'
for: 2m
labels:
severity: warning
annotations:
summary: MySQL InnoDB Force Recovery is enabled (instance {{ $labels.instance }})
description: "MySQL InnoDB force recovery is enabled on {{ $labels.instance }}\n VALUE = {{ $value }}\n LABELS = {{ $labels }}"