zabbix3.0.4 using Percona-monitoring-plugins plug-ins to monitor the detailed implementation of mysql5.6
Because Zabbix's own MySQL monitoring does not provide the key that can be used directly, so generally do not use, the industry's classmates use Percona monitoring Plugins to monitor the way of MySQL
Percona has improved MySQL database server, with a significant increase in functionality and performance compared to MySQL. This version improves the performance of InnoDB under high load conditions, provides some very useful performance diagnostic tools for DBAs, and additional parameters and commands to control server behavior.
Monitor the MySQL server on the line, Percona Monitor plugin is PHP development, so to install PHP environment in Agent
First, zabbix-agent-side operation (that is, the monitored MySQL server)
1. Installing the PHP environment and plugins
① Installing the PHP environment
Percona Monitor Plugin is PHP development, so to install PHP environment in Agent
Yum install zabbix-agent php php-~]# rpm-qa zabbix-agent php php-mysqlphp-5.3. 3-El6.x86_64zabbix-agent-1.8. 1. el6.x86_64php-mysql-5.3. 3-el6.x86_64.
② Installing the Percona plugin
[Email protected] ~]# RPM-IVH https://www.percona.com/downloads/percona-monitoring-plugins/ percona-monitoring-plugins-1.1.7/binary/redhat/6/x86_64/percona-zabbix-templates-1.1.7-2.noarch.rpm
③ Configuration Parameters
mkdir -p/etc/zabbix/CP /var/lib/zabbix/percona/templates/userparameter_percona_ Mysql.conf/etc/zabbix/zabbix_agentd.d/userparameter_percona_mysql.conf
Include the template in the configuration file
# vim/etc/zabbix/zabbix_agentd.conf
Add the following:
include=/etc/zabbix/zabbix_agentd.d/
Restart takes effect
Service Zabbix-agent Restart
2. Modify the monitoring-related scripts:
① editing the monitored php configuration file (using this profile to get the MySQL account password)
Add a single user with lower privileges Zabbix is dedicated to monitoring the database
Mysql> GRANT process,super,replication CLIENT on * * to [email protected]'localhost' 'zabbixpassword'; MySQL> Flush privileges;
# vim/var/lib/zabbix/percona/scripts/ss_get_mysql_stats.php.cnf<? 'zabbix' Zabbixpassword ';
② Edit ss_get_mysql_stats.php file, modify the specific user name, password, socket, MySQL port and other parameters
# vim/var/lib/zabbix/percona/scripts/'zabbix ' Zabbixpassword'3306"/tmp/mysql.sock" ;
③ Test in Zabbix-agent client (must be able to get data, otherwise the server will not be able to obtain monitoring data)
#/var/lib/zabbix/percona/scripts/get_mysql_stats_wrapper. SH NJ 276671 /var/lib/zabbix/percona/scripts/get_mysql_stats_wrapper. SH GW 1
Second, Zabbix-server web-side operation
1. Import the Monitoring template
Error:
Nvalid tag "/zabbix_export/date": "Yyyy-mm-ddthh:mm:ssz" is expected.
Import the Zabbix_agent_template_percona_mysql_server_ht_2.0.9-sver1.1.6.xml into the zabbix2.4 and then export. After importing the new export XML into 3.0, the problem is resolved.
2. Modify Log Permissions
chown -R zabbix.zabbix/tmp/localhost-mysql_cacti_stats.txt
3. Add Client Templates
4. Verify that the server is active and view the image
Client/var/lib/zabbix/percona/templates/userparameter_percona_mysql.conf files can see the supported monitoring entries
192.168. 3.12 -K MySQL. file-reads171192.168. 3.12 -K mysql.os-waits2
Third, monitoring MySQL master-slave
Need to be configured on the slave node
Modify the monitoring script on the slave, add account, password, socket and other parameters
# Vim/var/lib/zabbix/percona/scripts/get_mysql_stats_wrapper.SHRES= ' Home=~zabbix mysql-h192.168.3. --uzabbix-pzabbixpassword-s/TMP/MYSQL.SOCK-E'SHOW SLAVE status\g'|Egrep '(slave_io_running| slave_sql_running):'|awk-F:'{print $}'|TR '\ n' ','`
zabbix3.0.4 using Percona-monitoring-plugins plug-ins to monitor the detailed implementation of mysql5.6