promethues mysql-rules

groups:

  • name: mysql.rules

rules:

  • alert: MysqlDown

expr: mysql_up == 0

for: 1s

labels:

severity: critical

annotations:

title: 'MySQL down'

description: "Mysql实例: 【{{ $labels.instance }}】, MySQL instance is down"

  • alert: MysqlTooManyConnections(>80%)

expr: avg by (instance) (rate(mysql_global_status_threads_connected[1m])) / avg by (instance) (mysql_global_variables_max_connections) * 100 > 80

for: 2m

labels:

severity: warning

annotations:

title: 'MySQL too many connections (> 80%)'

description: "Mysql实例: 【{{ labels.instance }}】, More than 80% of MySQL connections are in use, Current Value: {{ value }}%"

  • alert: MysqlThreadsRunningHigh

expr: mysql_global_status_threads_running > 80

for: 2m

labels:

severity: warning

annotations:

title: 'MySQL Threads_Running High'

description: "Mysql实例: 【{{ labels.instance }}】, Threads_Running above the threshold(40), Current Value: {{ value }}"

  • alert: MysqlTooManyClientThreadsActivity

expr: mysql_global_status_threads_connected{instance !~ "10.xxx:3306||10.xxxx:3306"} > 120

for: 2m

labels:

severity: warning

annotations:

title: 'Too many Client Thread activity'

description: "Mysql实例:【{{ labels.instance }}】, {{ value }} Too many Client Thread activity"

  • alert: MysqlQpsHigh

expr: sum by (instance) (rate(mysql_global_status_queries[2m])) > 500

for: 2m

labels:

severity: warning

annotations:

title: 'MySQL QPS High'

description: "Mysql实例: 【{{ labels.instance }}】, MySQL QPS above 500, Current Value: {{ value }}"

  • alert: MysqlSlowQueries

expr: increase(mysql_global_status_slow_queries[1m]) > 0

for: 2m

labels:

severity: warning

annotations:

title: 'MySQL slow queries'

description: "Mysql实例: 【{{ $labels.instance }}】, has some new slow query."

  • alert: MysqlTooManyAbortedConnections

expr: round(increase(mysql_global_status_aborted_connects[5m])) > 300

for: 5m

labels:

severity: warning

annotations:

title: 'MySQL too many Aborted connections in 5 minutes'

description: "Mysql实例: 【{{ labels.instance }}】, {{ value }} Aborted connections within 5 minutes"

  • alert: MysqlTooManyAbortedClients

expr: round(increase(mysql_global_status_aborted_clients[120m])) > 300

for: 2m

labels:

severity: warning

annotations:

title: 'MySQL too many Aborted connections in 2 hours'

description: "Mysql实例: 【{{ labels.instance }}】, {{ value }} Aborted Clients within 2 hours"

  • alert: MysqlSlaveIoThreadNotRunning

expr: mysql_slave_status_master_server_id > 0 and ON (instance) mysql_slave_status_slave_io_running == 0

for: 1s

labels:

severity: critical

annotations:

title: 'MySQL Slave IO thread not running'

description: "Mysql实例: 【{{ $labels.instance }}】, MySQL Slave IO thread not running"

  • alert: MysqlSlaveSqlThreadNotRunning

expr: mysql_slave_status_master_server_id > 0 and ON (instance) mysql_slave_status_slave_sql_running == 0

for: 1s

labels:

severity: critical

annotations:

title: 'MySQL Slave SQL thread not running'

description: "Mysql实例: 【{{ $labels.instance }}】, MySQL Slave SQL thread not running"

  • alert: MysqlSlaveReplicationLag

expr: mysql_slave_status_master_server_id > 0 and ON (instance) (mysql_slave_status_seconds_behind_master - mysql_slave_status_sql_delay) > 30

for: 1m

labels:

severity: critical

annotations:

title: 'MySQL Slave replication lag'

description: "Mysql实例: 【{{ $labels.instance }}】, MySQL replication lag"

  • alert: MysqlInnodbLogWaits

expr: rate(mysql_global_status_innodb_log_waits[15m]) > 10

for: 0m

labels:

severity: warning

annotations:

title: 'MySQL InnoDB log waits'

description: "Mysql实例: 【{{ $labels.instance }}】, innodb log writes stalling"

  • alert: mysql_table_locks

expr: increase(mysql_global_status_table_locks_waited{job="mysqld_exporter"}[2m])

for: 0m

labels:

severity: warning

annotations:

title: 'MySQL table_locks'

description: "Mysql实例: 【{{ $labels.instance }}】, mysql table locks"

相关推荐
AD钙奶-lalala1 小时前
android:foregroundServiceType详解
android
大胃粥4 小时前
Android V app 冷启动(13) 焦点窗口更新
android
Zzzone6836 小时前
MySQL故障排查与生产环境优化
mysql
苹果醋37 小时前
AI大模型竞赛升温:百度发布文心大模型4.5和X1
java·运维·spring boot·mysql·nginx
皮皮林5517 小时前
面试官问:你写代码会复用公共 SQL 么?
mysql
fatiaozhang95278 小时前
中兴B860AV1.1_晨星MSO9280芯片_4G和8G闪存_TTL-BIN包刷机固件包
android·linux·adb·电视盒子·av1·魔百盒刷机
一线大码9 小时前
SpringBoot 和 MySQL 的事务隔离级别关系
spring boot·后端·mysql
在未来等你9 小时前
SQL进阶之旅 Day 28:跨库操作与ETL技术
sql·mysql·postgresql·etl·cross-database·data-integration·database-optimization
fatiaozhang95279 小时前
中兴B860AV1.1_MSO9280_降级后开ADB-免刷机破解教程(非刷机)
android·adb·电视盒子·av1·魔百盒刷机·移动魔百盒·魔百盒固件
二流小码农9 小时前
鸿蒙开发:绘制服务卡片
android·ios·harmonyos