标签:exporter prometheus mysqld usr 监控 mysql local
配置prometheus监控mysql服务
环境:已经装好mysql的centos7系统
- 添加用于监控的mysql账号
grant replication client,process on *.* to 'mysql_monitor'@'localhost' identified by '123456';
grant select on *.* to 'mysql_monitor'@'localhost';
exit;
下载mysqld_exporter
wget https://github.com/prometheus/mysqld_exporter/releases/download/v0.13.0/mysqld_exporter-0.13.0.linux-amd64.tar.gz
tar zxvf mysqld_exporter-0.13.0.linux-amd64.tar.gz -C /usr/local/
mv mysqld_exporter-0.13.0.linux-amd64 mysqld_exporter
vim /usr/local/mysqld_exporter/.my.cnf
[client]
user=mysql_monitor
password=123456
- 创建运行账户
useradd -m -s /sbin/nologin prometheus
- 编辑systemctl配置文件
vim /etc/systemd/system/mysqld_exporter.service
[Unit]
Description=mysqld_exporter
After=network.target
[Service]
Type=simple
User=prometheus
ExecStart=/usr/local/mysqld_exporter/mysqld_exporter --config.my-cnf="/usr/local/mysqld_exporter/.my.cnf"
Restart=on-failure
[Install]
WantedBy=multi-user.target
重载systemctl
systemctl daemon-reload
启动mysqld_exporter
systemctl enable --now mysqld_exporter
标签:exporter,prometheus,mysqld,usr,监控,mysql,local 来源: https://blog.csdn.net/qq_37696855/article/details/122722077
本站声明: 1. iCode9 技术分享网(下文简称本站)提供的所有内容,仅供技术学习、探讨和分享; 2. 关于本站的所有留言、评论、转载及引用,纯属内容发起人的个人观点,与本站观点和立场无关; 3. 关于本站的所有言论和文字,纯属内容发起人的个人观点,与本站观点和立场无关; 4. 本站文章均是网友提供,不完全保证技术分享内容的完整性、准确性、时效性、风险性和版权归属;如您发现该文章侵犯了您的权益,可联系我们第一时间进行删除; 5. 本站为非盈利性的个人网站,所有内容不会用来进行牟利,也不会利用任何形式的广告来间接获益,纯粹是为了广大技术爱好者提供技术内容和技术思想的分享性交流网站。