当前位置:Gxlcms > 数据库问题 > prometheus-mysql监控

prometheus-mysql监控

时间:2021-07-01 10:21:17 帮助过:22人阅读

cd /data/mysqld_exporter/conf
vi test.cnf

 

内容如下:

[client]
user=admin
password=admin123
port=3306
host=rdsxx.mysql.rds.aliyuncs.com

注意:这里推荐使用高权限账号。

 

启动进程

cd /data/mysqld_exporter
nohup ./mysqld_exporter --config.my-cnf="conf/test.cnf" --web.listen-address=":9104" &

 

生产RDS,也是类似步骤。新建一个 prod.cnf,填写对应的信息。

启动进程

cd /data/mysqld_exporter
nohup ./mysqld_exporter --config.my-cnf="conf/prod.cnf" --web.listen-address=":9105" &

观察是否有报错信息,如果没有报错信息,就可以封装service服务了

 

访问metrics

curl http://localhost:9104/metrics
curl http://localhost:9105/metrics

 如果数据输出正常,则表示成功。

 

promethus增加job

vim /data/prometheus/prometheus.yml

 

最后一行添加

技术图片
  - job_name: ‘mysqld_exporter‘
    static_configs:
    - targets: [‘localhost:9104‘]
      labels:
        instance: 测试
    - targets: [‘localhost:9105‘]
      labels:
        instance: 生产
技术图片

最后,重启prometheus

 

Granfana 导入Mysql 监控图表

  • 推荐图标ID:https://grafana.com/dashboards/7362

prometheus-mysql监控

标签:观察   get   oid   alt   图表   注意   auto   href   pass   

人气教程排行