Zabbix monitoring of MySQL is achieved by using the Mysql_performance_monitor package.
1. Install dependent software.
Yum install Perl-file-which perl-libwww-perl perl-digest-sha perl-dbd-mysql perl-time-hires perl-Crypt-SSLeay php Php-mysql
2. Download the Mysql_performance_monitor package.
Wget-c http://www.shinguz.ch/download/mysql_performance_monitor-latest.tar.gz
Tar XF mysql_performance_monitor-latest.tar.gz
3. Install the Percona-monitor-templates package.
[Email protected] ~]# RPM-IHV https://www.percona.com/downloads/percona-monitoring-plugins/1.1.5/ percona-zabbix-templates-1.1.5-1.noarch.rpm
Retrieving https://www.percona.com/downloads/percona-monitoring-plugins/1.1.5/percona-zabbix-templates-1.1.5-1.noarch.rpm
Warning:/var/tmp/rpm-tmp. P8evay:header V4 dsa/sha1 Signature, key ID Cd2efd2a:nokey
Preparing ... ########################################### [100%]
1:percona-zabbix-template########################################### [100%]
Scripts is installed to/var/lib/zabbix/percona/scripts
Templates is installed To/var/lib/zabbix/percona/templates
4. View the Percona-zabbix-templates package build directory file location.
[Email protected] ~]# 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.5.xml
5. Copy the configuration file userparameter_percona_mysql.conf to the Zabbix configuration file directory.
[Email protected] ~]# cp/var/lib/zabbix/percona/templates/userparameter_percona_mysql.conf/etc/zabbix/zabbix_ agentd.d/
6. Restart the Zabbix-agent service.
[Email protected] ~]#/etc/init.d/zabbix-agent restart
Shutting down Zabbix agent: [OK]
Starting Zabbix agent: [OK]
7. Modify the user name and password for the connected database
[Email protected] ~]# grep-a 1 root/var/lib/zabbix/percona/scripts/ss_get_mysql_stats.php
$mysql _user = ' user_name ';
$mysql _pass = ' password ';
8. Test.
[Email protected] ~]#/var/lib/zabbix/percona/scripts/get_mysql_stats_wrapper.sh GG
2
If there is no data, do the following to see if the sock configuration file location for MySQL in/etc/php.ini is correct.
/usr/bin/php-q/var/lib/zabbix/percona/scripts/ss_get_mystats.php--host localhost--items gg
Troubleshoot errors with error messages.
Zabbix monitoring MySQL