Percona-zabbix-templates plugin installation and monitoring MySQL and perconamysql monitoring
The monitored machine has installed php.
1. Install the mysql monitoring plug-in rpm package on the zabbix Client
Rpm-ivh https://www.percona.com/downloads/percona-monitoring-plugins/1.1.6/percona-zabbix-templates-1.1.6-1.noarch.rpm
Cd/var/lib/zabbix/percona/templates
Cp userparameter_percona_mysql.conf/usr/local/zabbix/etc/zabbix_agentd.conf.d/# (the specific path depends on the actual situation)
Import this template file zabbix_agent_template_percona_mysql_server_ht_2.0.9-sver1.1.6.xml on the zabbix monitoring page
2. Edit the configuration file/usr/local/zabbix/etc/zabbix_agentd.conf.
Include=/usr/local/zabbix/etc/zabbix_agentd.conf.d/
3. Modify the MySQL Command Execution file/var/lib/zabbix/percona/scripts/get_mysql_stats_wrapper.sh
RES=`HOME=~zabbix /usr/bin/mysql -uUSER -pPASS -e 'SHOW SLAVE STATUS\G' | egrep '(Slave_IO_Running|Slave_SQL_Running):' | awk -F: '{print $2}' | tr '\n' ','`
Change the/var/lib/zabbix/percona/scripts/ss_get_mysql_stats.php file to the MySQL user name and password.
$mysql_user = 'USER';$mysql_pass = 'PASS';
4. Add MySQL monitoring on the zabbix monitoring page and select the Percona MySQL Server Template