Zabbix监控mysql
目录
1.Install Zabbix agent and MySQL client
* 1. Install Zabbix agent and MySQL client. If necessary, add the path to the mysql and mysqladmin utilities to the global environment variable PATH.
Install Zabbix agent and MySQL client
密码查看 grep "password" /var/log/mysqld.log 2021-10-22T02:11:26.214298Z 1 [Note] A temporary password is generated for root@localhost: 71p=K-p-mVur
2 Copy template_db_mysql.conf
Copy template_db_mysql.conf into the folder with Zabbix agent
configuration (/etc/zabbix/zabbix_agentd.d/ by default). Don't forget to restart Zabbix agent.
cp /usr/share/doc/zabbix-agent-4.4.10/userparameter_mysql.conf /etc/zabbix/zabbix_agentd.d/
3. Create a MySQL user for monitoring (<password> at yourdiscretion)
CREATE USER 'zbx_monitor'@'%' IDENTIFIED BY '<password>'; GRANT REPLICATION CLIENT,PROCESS,SHOW DATABASES,SHOW VIEW ON *.* TO 'zbx_monitor'@'%';
4. Create .my.cnf in the home directory of Zabbix agent for Linux(/var/lib/zabbix by default )
mkdir -p /var/lib/zabbix chown -R zabbix:zabbix /var/lib/zabbix vi /var/lib/zabbix/.my.cnf [client] user='zbx_monitor' password='<password>'
上次居然看不懂官方的 ,看来英文近来是提升了一点点呀
注意
使用Zabbix自带模板监控MySQL时,Zabbix Server编译时需要使用“--with-libxml2”加入“libxml2”库。如果没有,需要重新编译Zabbix Server并重启。在CentOS中,可以通过“yum -y install libxml2 libxml2-devel”安装“libxml2”库。 通过Zabbix源码目录中的“config.log”文件查看编译选项:
- cat /usr/local/src/zabbix-5.0.10/config.log | grep '^.*configure.*--prefix'
see also
mysql monitoring zabbix.com Zabbix5.0 监控MySQL
Zabbix 监控Mysql 主从
qk 他们是监控了很多选项的 而我没空搞这么多
参考
[ ]