当前位置: 首页 > news >正文

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"
 

http://www.lryc.cn/news/110052.html

相关文章:

  • Maven项目中Lifecycle和Plugins下的install的区别
  • 02-状态模式
  • Python异常处理中异常的种类有哪些?你知道几个?
  • COBOL语言介绍及使用场景
  • 【计算机视觉 | 图像分割】arxiv 计算机视觉关于图像分割的学术速递(8 月 1 日论文合集)
  • Jetson nano 安装swapfile 解决Cannot allocate memory 问题
  • ElasticsSearch基础概念和安装
  • 【GEMM预备工作】行主序和列主序矩阵的内存中的连续性,解决理解问题
  • 利用el-button 画圆 ,通过border-radius >50% 就成圆形
  • 在tensorflow分布式训练过程中突然终止(终止)
  • windows永久暂停更新
  • Android 9系统源码_音频管理(一)按键音效源码解析
  • PyTorch搭建神经网络
  • TiDB 优雅关闭
  • 食品厂能源管理系统助力节能减排,提升可持续发展
  • ABAP读取文本函数效率优化,read_text --->zread_text
  • Spring Data Repository 使用详解
  • [ MySQL ] — 数据库环境安装、概念和基本使用
  • Apache Thrift C++库的TThreadPoolServer模式的完整示例
  • 图解java.util.concurrent并发包源码系列——深入理解ReentrantLock,看完可以吊打面试官
  • 【计算机网络】网络基础(上)
  • 51单片机(普中HC6800-EM3 V3.0)实验例程软件分析 实验四 蜂鸣器
  • 无向图-已知根节点求高度
  • RIP动态路由协议 (已过时,逐渐退出舞台)
  • C++ operator关键字的使用(重载运算符、仿函数、类型转换操作符)
  • 深度学习笔记-暂退法(Drop out)
  • 使用自适应去噪在线顺序极限学习机预测飞机发动机剩余使用寿命(Matlab代码实现)
  • 实验5-7 使用函数求1到10的阶乘和 (10 分)
  • kafka部署
  • Spring Security6入门及自定义登录