Reference Documentation:
Percona Official Document: https://www.percona.com/doc/percona-monitoring-plugins/LATEST/zabbix/index.html
Installation method of zabbix2.4: https://www.cnblogs.com/irockcode/p/6752316.html
Other blogger documents: http://blog.51cto.com/xiaozhagn/2059713
centos7.4 Client Installation Agent
http://blog.csdn.net/jas0n_liu/article/details/77099626
http://www.cnblogs.com/bigbrotherer/p/7241845.html #centos7.4 Installing the Database
Zabbix the MySQL plugin to monitor the MySQL database, but you will find that the MySQL monitor is very small, in order to do more detailed monitoring, Percona provides this detailed monitoring of the template and script, to solve the problem of incomplete monitoring.
https://www.percona.com/downloads/percona-monitoring-plugins/LATEST/
Zabbix Client Installation (centos7.4)
Yum-y Install http://repo.zabbix.com/zabbix/3.4/rhel/7/x86_64/zabbix-release-3.4-1.el7.centos.noarch.rpm
Yum Install Zabbix-sender zabbix-agent zabbix-get-y
Change in/etc/zabbix/zabbix_agentd.conf:
Server=<
Serveractive=<Zbx-server's ip>
Hostname=< The name of the machine >
#设置启动和开机项
Systemctl Start Zabbix-agent
Systemctl enable zabbix-agent. Service
#关闭防火墙
Systemctl Disable FIREWALLD
1, Percona plug-in installation
#官网下载percona的rpm包, I'm here to download the 1.1.8 version of
cd /usr/local/src/
Yum-y Install https://www.percona.com/downloads/percona-monitoring-plugins/percona-monitoring-plugins-1.1.8/binary/ redhat/7/x86_64/percona-zabbix-templates-1.1.8-1.noarch.rpm
#安装percona的rpm包 Install the PHP plugin
yum-y Install percona-zabbix-templates php php-mysql
#查看percona installation information for-zabbix-templates
[[email protected] Zabbix] # rpm-ql percona-zabbix-templates
/var/lib/zabbix/percona
/var/lib/zabbix/percona/scripts
/var/lib/ zabbix/percona/scripts/get_mysql_stats_wrapper.sh
/var/lib/zabbix/percona/scripts/ss_get_mysql_stats.php
/var/lib/zabbix/percona/templates
/var/lib/zabbix/percona/templates/userparameter_percona_mysql.conf
/var/lib/zabbix/percona/templates/ zabbix_agent_template_percona_mysql_server_ht_2.0.9- Sver1.1.8.xml #这个时模板, you need to import into zabbix3.4.
#使用sz export the template to local, import it into zabbix2.4 and then export the template in order to import into zabbix3.4;
The already-poured template address is as follows and can be imported directly into the zabbix3.4:
Https://pan.baidu.com/s/1-dTDwYNCCrvIh01dO4BEHA
/var/lib/zabbix/percona/scripts/two files in this, SH's script is to monitor the MySQL status, the PHP file is configured to connect the database user name password. Use the shell to invoke PHP. /var/lib/zabbix/percona/templates/this inside of the two files, the Conf file is to be placed on the agent side/etc/zabbix/zabbix_agentd.d/below, the XML file is a template file.
2. Enter the templates directory and copy the template file to the ZABBIX_AGENTD.CONF.D directory.
[[email protected] ~]# Cd/var/lib/zabbix/percona/templates/[[email protected] templates]# ll total dosage 284-rw-r--r--. 1 root root 18866 January 22:46 userparameter_percona_mysql.conf-rw-r--r--. 1 root root 269258 January 22:46 Zabbi X_agent_template_percona_mysql_server_ht_2.0.9-sver1.1.8.xml
[email protected] templates]# CP userparameter_percona_mysql.conf/etc/zabbix/zabbix_agentd.d/
#重启agent服务
Systemctl Restart Zabbix-agent.service
3. Modify the mysql execution command file, change the MySQL user and password
[Email protected] scripts]# pwd/var/lib/zabbix/percona/scripts[[email protected] scripts]# vim Ss_get_mysql_ Stats.php.cnf<?php$mysql_user = ' root '; #mysql用户, the production will create a read-only user $mysql_pass = '; #mysql密码, because this station has no password so empty;
Troubleshooting steps:
1, the machine is normal
/var/lib/zabbix/percona/scripts/get_mysql_stats_wrapper.sh NJ #有返回值正常
2, server side can obtain
Zabbix_get-s 10.0.0.111-k "Mysql.max-connections" #返回数值正常
#需要参考的博文:
Https://www.cnblogs.com/caoxiaojian/p/5706992.html
http://blog.csdn.net/mchdba/article/details/51447750
Http://blog.chinaunix.net/uid-20776139-id-4060624.html
http://blog.51cto.com/xiaozhagn/2059713
Http://www.mamicode.com/info-detail-1839405.html
Http://www.bubuko.com/infodetail-2076217.html
http://blog.csdn.net/tianhua79658788/article/details/77936156
Test whether the script can get state information to the database
The script needs to test two parts of the content
1. State variables of the MySQL instance itself
2. is MySQL a slave
Test the state variables of the MySQL instance itself
#/var/lib/zabbix/percona/scripts/get_mysql_stats_wrapper.sh GG
Test if MySQL is a slave
#/var/lib/zabbix/percona/scripts/get_mysql_stats_wrapper.sh Running-slave
Returns 0 and 1 are normal, and returning to "Access denied" is problematic.
Fault case:
zabbix3.0.2 using Percona's MySQL plugin to solve the bizarre problem resolution record: http://blog.csdn.net/mchdba/article/details/51447560
Zabbix daily Monitoring Item MySQL (vii)