How to install MySQL monitoring plug-in PMP and zabbixpmp on Zabbix
PMP (Percona Monitoring Plugins) is a plug-in written by Percona for MySQL Monitoring. Supports Nagios and Cacti. Zabbix is supported starting from PMP 1.1.
Next, let's see how to install PMP on Zabbix.
Configure Zabbix Agent
Download PMP
: Https://www.percona.com/downloads/percona-monitoring-plugins/
Because my Linux version is RHEL 6.7, select the RPM package
# Wget https://www.percona.com/downloads/percona-monitoring-plugins/1.1.6/percona-zabbix-templates-1.1.6-1.noarch.rpm
# Rpm-ivh percona-zabbix-templates-1.1.6-1.noarch.rpm
warning: percona-zabbix-templates-1.1.6-1.noarch.rpm: Header V4 DSA/SHA1 Signature, key ID cd2efd2a: NOKEYPreparing... ########################################### [100%] 1:percona-zabbix-template########################################### [100%]Scripts are installed to /var/lib/zabbix/percona/scriptsTemplates are installed to /var/lib/zabbix/percona/templates
Copy the PMP configuration file
# Cp/var/lib/zabbix/percona/templates/userparameter_percona_mysql.conf/etc/zabbix/zabbix_agentd.d/
Make sure that Include =/etc/Zabbix/zabbix_agentd.d/is enabled in the zabbix-Agent configuration file/
Restart Zabbix-Agent service
# Service zabbix-agent restart
Create a MySQL monitoring user
Mysql> grant process, super, select on *. * to monitor @ 'localhost' identified by 'monitor ';
Mysql> flush privileges;
Modify the username and password in the script
# Vim/var/lib/zabbix/percona/scripts/ss_get_mysql_stats.php
$mysql_user = 'monitor';$mysql_pass = 'monitor';$mysql_port = 3306;
Test whether the script can obtain the database status information
This script requires two parts to be tested.
1. Status variables of the MySQL instance itself
2. Whether MySQL is Slave
Test the status variable of the MySQL instance.
#/Var/lib/zabbix/percona/scripts/get_mysql_stats_wrapper.sh gg
/var/lib/zabbix/percona/scripts/get_mysql_stats_wrapper.sh: line 35: /usr/bin/php: No such file or directoryERROR: run the command manually to investigate the problem: /usr/bin/php -q /var/lib/zabbix/percona/scripts/ss_get_mysql_stats.php --host localhost --items gg
Because the script is implemented in PHP, you need to install php and php-mysql.
# Yum install php-mysql
Test the script again.
#/Var/lib/zabbix/percona/scripts/get_mysql_stats_wrapper.sh gg
If a value is returned, OK is returned.
Test whether MySQL is Slave
#/Var/lib/zabbix/percona/scripts/get_mysql_stats_wrapper.sh running-slave
Returns 0 and 1 are normal values, and returns "Access denied.
Import PMP Template
The zabbix_agent_template_percona_mysql_server_ht_2.0.9-sver1.1.6.xml in the/var/lib/zabbix/percona/templates directory