the existing environment already has Zabbix server and agent side installed
1 Download percona Monitor plugin
https://www.percona.com/downloads/percona-monitoring-plugins/LATEST/
after download the name is as follows percona-zabbix-templates-1.1.8-1.noarch.rpm
2 upload the plugin to the server
Rz
3 Installing plugins
RPM-IVH percona-zabbix-templates-1.1.8-1.noarch.rpm
Post-installation directory structure
[Email protected] ~]# RPM-QL percona-zabbix-templates
4 Installing the PHP environment
Yum Install PHP php-mysql–y
5 Copy the configuration file to the/ETC/ZABBIX/ZABBIX_AGENTD.CONF.D directory
Cp/var/lib/zabbix/percona/templates/userparameter_percona_mysql.conf/etc/zabbix/zabbix_agentd.conf.d
Turn on monitoring in this directory
Vim/etc/zabbix/zabbix_agentd.conf
Add this line of content
Include=/etc/zabbix/zabbix_agentd.d/*.conf
modification of Agent 's configuration file requires reboot to take effect
/etc/init.d/zabbix-agent restart
Shutting down Zabbix agent: [OK]
Starting Zabbix agent: [OK]
6 Create a database user for monitoring
GRANT SELECT, PROCESS, SUPER, REPLICATION CLIENT on *. * to ' Zabbix ' @ ' localhost ' identified by ' Zabbix ';
Flush privileges;
7 modifying a php configuration file
Change the account password for the in-database monitoring
vim/var/lib/zabbix/percona/scripts/ss_get_mysql_stats.php
$mysql _user = ' Zabbix ';
$mysql _pass = ' Zabbix ';
8 Test whether the script can get the value
/var/lib/zabbix/percona/scripts/get_mysql_stats_wrapper.sh GW
198635444
two Zabbix Web import monitoring template
1 Download template with self-template will report the time format error as follows
1 Download the new template
Wget Http://jaminzhang.github.io/soft-conf/Zabbix/zbx_percona_mysql_template.xml
2 Import Template zbx_percona_mysql_template
3 Adding a template to a host
three error handling
monitoring Error 1 :
Received value [rm:cannot remove '/tmp/localhost-mysql_cacti_stats.txt ': Operation not permitted18880] was not suitable fo R value type [Numeric (float)]
[Email protected] tmp]# RM-RF localhost-mysql_cacti_stats.txt
[email protected] tmp]# Touch localhost-mysql_cacti_stats.txt
[Email protected] tmp]#
[Email protected] tmp]# chown-r Zabbix:zabbix localhost-mysql_cacti_stats.txt
four master-slave Replication Monitoring
1 manual Run script check
Sh/var/lib/zabbix/percona/scripts/get_mysql_stats_wrapper.sh Running-slave
ERROR 1045 (28000): Access denied for user ' root ' @ ' localhost ' (using Password:no)
0
2 Modify configuration file add monitoring account and password
Modifying a configuration file
Vim MY.CNF
Add the following content
User=zabbix
Password=zabbix
3 re-check and find out.
ERROR 1045 (28000): Access denied for user ' root ' @ ' localhost ' (using Password:no)
so far can monitor master-slave replication.
Reference Documentation:
Official Configuration Document
Https://www.percona.com/doc/percona-monitoring-plugins/1.1/zabbix/index.html
Zabbix monitoring MySQL through Percona templates