Zabbix implementation of MySQL database monitoring (iii)

Source: Internet
Author: User
Tags install php php development environment php script percona

The above chapter "Zabbix implementation of MySQL database monitoring (ii)" Using MPM to monitor MySQL, but encountered installation problems always can not solve, here instead of Percona-monitoring-plugins to monitor the MySQL database zabbxi.

For more information on Percona-monitoring-plugins, see: Https://

First, the Environment preparation

    • PHP Development Environment Building
    • Download Percona-monitoring-plugins file

1. Build PHP Environment

Since Percona-monitoring-plugins is written in PHP, it is necessary to build a PHP development environment, the following steps:

1) Install Apache: Pre-Install Apr,apr-util,pcre dependency pack when installing Apache

wgethttp// apr-1.4.5.Tar. GZCD Apr-1.4.5./configure--prefix=/usr/local/Apr Make&& Make Installwgethttp// apr-util-1.3. A.Tar. GZCD Apr-util-1.3. A./configure--prefix=/usr/local/apr-util-with-apr=/usr/local/apr/bin/apr-1-Config Make&& Make Installwgethttp// Pcre-8.10./configure--prefix=/usr/local/Pcre Make&& Make Install--Apache installation CD httpd-2.4. -./configure--prefix=/usr/local/Apache Make&& Make Install

2) Install PHP: Pre-install LIBXML2 dependencies prior to installing PHP

TarZXVF libxml2-2.6. +.Tar. GZ CD LIBXML2-2.6. +./configure--prefix=/usr/local/LIBXML2 Make&& Make Installcd PHP-5.6. -./configure--prefix=/usr/local/php--with-mysql=/usr/local/mysql--with-apxs2=/usr/local/apache/bin/apxs-- with-mysqli=/usr/local/mysql/bin/Mysql_config--with-mysql-sock=/tmp/mysql.sock--with-config-file-path=/usr/local/lib--with-libxml-dir=/usr/local/LIBXML2 Make&& Make Install

3) Configure Apache and PHP

/usr/local/apache/conf/httpd.confaddtype application/x-httpd-php. Phpaddtypeapplication/ x-httpd-php-source. phps# to the PHP installation package to find php.ini.dist, if not, php.ini-development can also, and then copy it to/usr/local/lib/  PHP.iniCP php.ini-Development php.ini.distCP php.ini.dist/usr/local/lib/ Ini

2. Download Percona-monitoring-plugins file

Official website:

For convenience, we download the RPM version here, the post-installation directory structure is this:

-----/var/lib/zabbix/Percona--------------------------scripts--------------------------------get_mysql_ Stats_wrapper. SH --------------------------------ss_get_mysql_stats.php--------------------------                                    templates--------------------------------userparameter_percona_mysql.conf #key配置文件--------------------------------zabbix_agent_template_percona_mysql_server_ht_2.0.9-sver1.1.5. xml #模板文件 that need to be imported into the front-end Zabbix template

Second, installation configuration Percona-monitoring-plugins

1, installation percona-monitoring-plugins

Yum Install percona-zabbix-templates-1.1. 5-1. noarch.rpm

The default installation is under the/var/lib/zabbix/percona directory.

2. Copy the key configuration file to the ZABBIX_AGENTD.CONF.D directory

CP /var/lib/zabbix/percona/templates/userparameter_percona_mysql.conf/usr/local/zabbix/etc/   - 1 18866  + userparameter_percona_mysql.conf:

If you do not have this directory, you can create a new one manually.

3. Ensure that the following parameters are included in the zabbix_agentd.conf :

[email protected] etc]# vim zabbix_agentd.conf      Include  =/usr/local/zabbix/etc/zabbix_agentd.conf.d/

4. Restart AGENTD Service

[Email protected] etc]#/etc/init.d/zabbix_agentd restart

5. Modify the ss_get_mysql_stats.php script

[Email protected] etc]# vim/var/lib/zabbix/percona/scripts/            ss_get_mysql_stats.php'MPM  ';             ' MPM ' ;             3306;

Make sure that the above username and password are available to connect to the MySQL database.

6. Test Percona-monitoring-plugins

127.0. 0.1 --items GG

GG represents an item in the monitoring, normally usually return a number, you can go to the TMP directory to see the cache file, which contains a variety of monitoring items and values.

7. Import the XML template into Zabbix

Here, with Zabbix monitoring MySQL is completed, the following to intercept a few specific monitoring effect:

Zabbix implementation of MySQL database monitoring (iii)

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.