Zabbix监控mysql

来自linux中国网wiki
跳到导航 跳到搜索

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. 

centos7 yum install mysql5.7

CentOS7 yum安装MySQL5.7

密码查看 
  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-5.0.18/userparameter_mysql.conf /etc/zabbix/zabbix_agentd.d/

 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”文件查看编译选项:


  1. cat /usr/local/src/zabbix-5.0.10/config.log | grep '^.*configure.*--prefix'

Zabbix 监控Mysql 主从

qk 他们是监控了很多选项的 而我没空搞这么多

参考

zabbix 5.0监控MySQL-2022

mysql monitoring zabbix.com

Zabbix5.0 监控MySQL

https://www.zabbix.com/documentation/current/manual/config/templates_out_of_the_box/zabbix_agent

zabbix 监控mysql状态以及mysql主从


Zabbix自动化监控——监控MySQL

[ ]

zabbix自定义key监控mysql

Zabbix 监控Mysql 主从状态(Python脚本

Zabbix监控mysql主从复制状态