prometheus监控mysql
mysql_exporter
项目地址:
mysql_exporter是用来收集MysQL或者Mariadb数据库相关指标的,mysql_exporter需要连接到数据库并有相关权限
mysql创建权限账户
mysql -uroot -p123456 CREATE USER 'exporter'@'localhost' IDENTIFIED BY 'devops'; GRANT PROCESS, REPLICATION CLIENT, SELECT ON *.* TO 'exporter'@'localhost'; FLUSH PRIVILEGES;
部署
下载软件
wget https://github.com/prometheus/mysqld_exporter/releases/download/v0.13.0/mysqld_exporter-0.13.0.linux-amd64.tar.gz tar xf mysqld_exporter-0.13.0.linux-amd64.tar.gz -C /opt/ ln -s /opt/mysqld_exporter-0.13.0.linux-amd64 /opt/mysqld_exporter
准备启动文件
[root@ops opt]# cat /usr/lib/systemd/system/mysqld_exporter.service [Unit] Description=mysqld_exporter Exporter Wants=network-online.target After=network-online.target [Service] Environment=DATA_SOURCE_NAME=exporter:devops@tcp/ ExecStart=/opt/mysqld_exporter/mysqld_exporter StandardOutput=syslog StandardError=syslog SyslogIdentifier=mysqld_exporter [Install] WantedBy=default.target
启动
systemctl start mysqld_exporter.service
systemctl enable mysqld_exporter.service
systemctl status mysqld_exporter.service
作者:闫世成
出处:http://cnblogs.com/yanshicheng
本文版权归作者和博客园共有,欢迎转载,但未经作者同意必须保留此段声明,且在文章页面明显位置给出原文连接。如有问题或建议,请联系上述邮箱,非常感谢。