mysql_exporter部署

mysql_exporter部署

   小白     2021年8月28日 18:30     1273    

1、下载

wget https://github.com/prometheus/mysqld_exporter/releases/download/v0.13.0/mysqld_exporter-0.13.0.linux-amd64.tar.gz

 

2、解压开

tar -zxvf mysqld_exporter-0.13.0.linux-amd64.tar.gz

mv mysqld_exporter-0.13.0.linux-amd64 mysqld_exporter

 

3、添加node_exporter启动文件

vim /usr/lib/systemd/system/mysql_exporter.service
[Unit]

Description=Prometheus_mysql

[Service]

ExecStart=/data/mysqld_exporter/mysqld_exporter --config.my-cnf=/data/mysqld_exporter/conf/my.cnf --web.listen-address=:9104

Restart=on-failure

[Install]

WantedBy=multi-user.target


使用my.cnf链接数据库

[client]

host=192.168.0.1

port=3306

user=mysql

password=123456


4、修改Prometheus配置文件

vim /data/prometheus/prometheus.yml

添加一下内容,根据实际情况进行修改  

 - job_name: "mysql_monitor"

    static_configs:

      - targets: ["192.168.153.130:9104"]

 

5、启动

systemctl start mysql_exporter

systemctl enable mysql_exporter


文章评论

0

其他文章