组件性能数据采集--Mysql数据采集

组件性能数据采集--Mysql数据采集

mysql_exporter下载安装配置及启动

下载

wget -c https://github.com/prometheus/mysqld_exporter/releases/download/v0.11.0/mysqld_exporter-0.11.0.linux-amd64.tar.gz
tar zxvf mysqld_exporter-0.11.0.linux-amd64.tar.gz

创建.my.cnf文件

cd mysqld_exporter-0.11.0.linux-amd64
vim .my.cnf
[client]
user=root
password=mysql@1234

启动mysqld_exporter

export DATA_SOURCE_NAME='root:mysql@1234@(106.12.161.221:3306)/'
nohup ./mysqld_exporter --config.my-cnf=".my.cnf" &
  • 开放9104端口

配置prometheus

  • 在prometheus.yml的最后面加上以下内容
  - job_name: "mysql221"
    static_configs:
      - targets: ['106.12.161.221:9104']
        labels:
          instance: mysql221
  • 杀掉进程重启prometheus
  • 导入dashboard:7362
posted @ 2022-06-28 16:46  77的小白  阅读(63)  评论(0)    收藏  举报