Zabbix using the Percona plugin to monitor MySQL

Source: Internet
Author: User
Tags install php percona

1, add Percona warehouse.

# yum install -y http://www.percona.com/downloads/percona-release/redhat/0.1-4/percona-release-0.1-4.noarch.rpm

2, install the plug-in.

# yum -y install percona-zabbix-templates# 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.8.xml

3, this project is written by PHP, you need to install PHP and Php-mysql on the agent. (This is stated on the official website)

# yum install -y php php-mysql

4, copy the configuration file to the configuration directory, and restart Zabbix-agent.

# cp -a /var/lib/zabbix/percona/templates/userparameter_percona_mysql.conf /etc/zabbix/zabbix_agentd.d/# service zabbix-agent restart

5, authorized to monitor users, so that they can obtain data.

# mysql -uroot -p> grant all privileges on *.* to [email protected] identified by ‘PASS‘;> flush privileges;> quit;

6, modify the user password inside the program, so that it can connect to MySQL.

# vim /var/lib/zabbix/percona/scripts/ss_get_mysql_stats.php$mysql_user = ‘zabbix‘;$mysql_pass = ‘PASS‘;

7. Test whether the script can get the data.

# /var/lib/zabbix/percona/scripts/get_mysql_stats_wrapper.sh gg16

8, import the template. Step here to the pit, the installation package provides plug-in version is 1.1.8, the import process error. After a query, you can use 1.1.6.

Logically, after importing a template, you can view the data by linking to the host. However, waited for a long time has no data, but also after a query ...

The plug-in creates a state file and then reads the data from it, but the first time the file is started, the user is root, and Zabbix's startup user is Zabbix, and there is no permission to read the file, so there is no data on the page.

The workaround is simple, delete the file, and the program will automatically create a new file with the correct permissions.

# rm -f /tmp/localhost-mysql_cacti_stats.txt

9, you can see the data here.

Zabbix using the Percona plugin to monitor MySQL

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: info-contact@alibabacloud.com 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.