输入banner图图片脚本导航/分类

prometheus-mysql监控

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