美文网首页
使用Prometheus监控Mysql

使用Prometheus监控Mysql

作者: JAVA日知录 | 来源:发表于2019-10-22 08:33 被阅读0次

之前我们讲了使用Prometheus监控服务器状态,今天我们使用Prometheus监控下数据库。

安装配置

  • mysqld_exporter 下载好mysql的exporter,上传至服务器。

  • 修改exporter配置
    在root目录下建立文件 .my.cnf,输入mysql的访问参数

[client]
host = 192.168.249.129
user = root
password = 000000

使用如下shell命令进行安装并启动

tar zxvf mysqld_exporter-0.12.1.linux-amd64.tar.gz
mv node_exporter-0.18.1.linux-amd64 mysqld_exporter
nohup ./mysqld_exporter --web.listen-address=":9200" &

启动完成后,用浏览器打开http://192.168.249.129:9200/进行访问,显示效果如下:

file
  • 修改prometheus配置
    在prometheusscrape_configs中加入mysql的监听地址
- job_name: 'mysql29'
    static_configs:
    - targets: ['192.168.249.129:9200']

监控报表

  • 从grafana官网上查找Mysql的监控dashboard MySQL_Overview并将其导入grafana。

    file
  • 查看监控效果


    file
    file

欢迎关注我的个人公众号:JAVA日知录

相关文章

网友评论

      本文标题:使用Prometheus监控Mysql

      本文链接:https://www.haomeiwen.com/subject/rcmfvctx.html