I. Overview
Zabbix the MySQL plugin to monitor the MySQL database, but it is too primitive, for our DBA, the basic does not have any role, so need to do more detailed monitoring, and Percona has this detailed monitoring of the template and script, just take it over.
Percona Official website: www.percona.com
Percona Composition Introduction
1. PHP Scripts for data collection
2. Shell scripts are used to invoke collection information
3. Zabbix configuration file
4. Zabbix template file
650) this.width=650; "src=" Https://s5.51cto.com/wyfs02/M02/97/D8/wKiom1kz5sTDLbJpAAMQPoVTW1o457.png "title=" QQ picture 20170604170114.png "alt=" Wkiom1kz5stdlbjpaamqpovtw1o457.png "/>
Second, installation and configuration
1. Download and install
https://www.percona.com/downloads/percona-monitoring-plugins/LATEST/
also supports Nagios and CATCTI
wget 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
RPM-IVH percona-zabbix-templates-1.1.7-2.noarch.rpm
Yum Install percona-zabbix-templates PHP php-mysql-y
650) this.width=650; "src=" Https://s4.51cto.com/wyfs02/M00/97/DA/wKioL1kz5vvCy_23AAHYiltzsJo203.png "title=" QQ picture 20170604172437.png "alt=" Wkiol1kz5vvcy_23aahyiltzsjo203.png "/>
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.7.xml for MySQL monitor template
Copy the configuration file to the/etc/zabbix/zabbix_agentd.d/directory
cp/var/lib/zabbix/percona/templates/userparameter_percona_mysql.conf/etc/zabbix/zabbix_agentd.d/
vim/var/lib/zabbix/percona/scripts/ss_get_mysql_stats.php
$mysql _user = ' root ';
$mysql _pass = ";
$mysql _port = 3306;
$mysql _socket = NULL;
$mysql _flags = 0;
The test environment root password is empty if the production environment creates a dedicated read-only account.
Need to change config file to restart
/etc/init.d/zabbix-agent restart
Testing will return the test results
cd/var/lib/zabbix/percona/scripts/
./get_mysql_stats_wrapper.sh GM
0
./get_mysql_stats_wrapper.sh GW
20060
2. Import templates
Import template times Wrong "tag invalid"/zabbix_export/date ":" Yyyy-mm-ddthh:mm:ssz "expected"
650) this.width=650; "src=" Https://s5.51cto.com/wyfs02/M01/97/D8/wKiom1kz5z6zqnKuAAFYhMOIx78761.png "title=" QQ picture 20170604182454.png "alt=" Wkiom1kz5z6zqnkuaafyhmoix78761.png "/>
Solutions
Import the Zabbix_agent_template_percona_mysql_server_ht_2.0.9-sver1.1.7.xml into the zabbix2.4 and then export. After importing the new export XML into 3.2, the problem is resolved.
Permissions issues
Received Value [RM: Cannot delete '/tmp/localhost-mysql_cacti_stats.txt ': Disallowed operation 0] is not suitable for value type [Numeric (float)]
650) this.width=650; "src=" Https://s3.51cto.com/wyfs02/M01/97/DA/wKioL1kz54ODgX7zAAOpfP-BapE873.png "title=" QQ picture 20170604183624.png "alt=" Wkiol1kz54odgx7zaaopfp-bape873.png "/>
Solutions
Cd/tmp
Chown-r Zabbix.zabbix Localhost-mysql_cacti_stats.txt
/etc/init.d/zabbix-agent restart
650) this.width=650; "src=" Https://s2.51cto.com/wyfs02/M02/97/DA/wKioL1kz6CziDAsaAAVexOYYLZ8764.png "title=" QQ picture 20170604184417.png "alt=" Wkiol1kz6czidasaaavexoyylz8764.png "/>
650) this.width=650; "src=" Https://s3.51cto.com/wyfs02/M00/97/D8/wKiom1kz6FXS5UwqAAIxIIg9mvU284.png "title=" QQ picture 20170604184402.png "alt=" Wkiom1kz6fxs5uwqaaixiig9mvu284.png "/>
This article is from the "Think" blog, make sure to keep this source http://10880347.blog.51cto.com/346720/1932100
zabbix3.2 monitoring MySQL Status