关于prometheus:Prometheus-MySQL-性能监控

60次阅读

共计 1205 个字符,预计需要花费 4 分钟才能阅读完成。

install mysql exporter


wget https://github.com/prometheus/mysqld_exporter/releases/download/v${VER}/mysqld_exporter-${VER}.linux-amd64.tar.gz

tar -xf mysqld_exporter-0.15.0-rc.0.linux-amd64.tar.gz
mv mysqld_exporter-0.15.0-rc.0.linux-amd64 

[root@vm1 ~]# cat /usr/local/mysqld_exporter/mysql.cnf 
[client]
user=read
password=m!ma
port=6333

add service

[root@vm1 home]# vim /usr/lib/systemd/system/mysqld_exporter.service
[Unit]
Description=mysqld_exporter
Documentation=https://prometheus.io
Wants=network-online.target
After=network.target
[Service]
Type=simple
User=root
ExecStart=/usr/local/mysqld_exporter/mysqld_exporter --config.my-cnf=/usr/local/mysqld_exporter/mysql.cnf --web.listen-address=0.0.0.0:39104
Restart=on-failure
[Install]
WantedBy=multi-user.target
[root@vm1 home]# systemctl daemon-reload
[root@vm1 home]# systemctl restart mysqld_exporter
[root@vm1 home]# systemctl enable mysqld_exporter
Created symlink from /etc/systemd/system/multi-user.target.wants/mysqld_exporter.service to /usr/lib/systemd/system/mysqld_exporter.service.
[root@vm1 home]# netstat -tnlp
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name    
tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN        1399/master         
tcp6       0      0 :::39104                :::*                    LISTEN      4456/mysqld_exporte 

正文完
 0