mysql 集群_prometheus监控mysql集群

安装mysql_exporter

cd /usr/localwget https://github.com/prometheus/mysqld_exporter/releases/download/v0.12.1/mysqld_exporter-0.12.1.linux-amd64.tar.gztar -zxvf mysqld_exporter-0.12.1.linux-amd64.tar.gzmv mysqld_exporter-0.12.1.linux-amd64 mysqld_exportermysql的pxc集群添加账号密码:GRANT REPLICATION CLIENT, PROCESS ON . TO 'exporter'@'localhost' identified by '123456';GRANT SELECT ON performance_schema.* TO 'exporter'@'localhost';flush privileges;[root@pxc1 mysqld_exporter]# cat .my.cnf [client]host=192.168.7.201user=exporterpassword=123456启动:nohup ./mysqld_exporter --config.my-cnf=.my.cnf &

prometheus配置

 - job_name: 'mysql-cluster'   static_configs:   - targets:     - '192.168.7.201:9104'     - '192.168.7.202:9104'     - '192.168.7.203:9104'               报警:############ mysql 监控 ############      - alert: MySQLGaleraNotReady        expr: mysql_global_status_wsrep_ready != 1        for: 5m        labels:          severity: warning        annotations:          description: "{{$labels.job}} on {{$labels.instance}} is not ready."          summary: "Galera cluster node not ready"      - alert: MySQLGaleraOutOfSync        expr: (mysql_global_status_wsrep_local_state != 4 and mysql_global_variables_wsrep_desync == 0)        for: 5m        labels:          severity: warning        annotations:          description: "{{$labels.job}} on {{$labels.instance}} is not in sync ({{$value}}!= 4)."          summary: "Galera cluster node out of sync"      - alert: MySQL is down        expr: mysql_up == 0        for: 1m        labels:          severity: critical        annotations:          description: "Instance {{ $labels.instance }} MySQL is down"          summary: "MySQL database is down. This requires immediate action!"      - alert: MySql 连接数超过最大连接数的80%        expr: mysql_global_status_max_used_connections > mysql_global_variables_max_connections * 0.8        for: 2m        labels:          severity: warning        annotations:          description: "Instance {{ $labels.instance }} Used more than 80% of max connections limited"          summary: "Used more than 80% of max connections limited"

grafana导入模板

https://grafana.com/grafana/dashboards/7362 mysqlhttps://grafana.com/grafana/dashboards/7377 pxc

da212b948596e249f6ee0e3ad99c1f33.png
c48daae8fafb0791775710a390cbd6f6.png
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值