Zabbix with plugin Percona monitor MySQL data
In the sense of Zabbix the MySQL plugin to monitor the MySQL database, but you will find that the MySQL monitoring items are very few, can not meet the needs of the company.
Because its own template is too simple, so need to do more detailed monitoring, and Percona provides this detailed monitoring template and script, to solve the problem of incomplete monitoring. 、
1, Percona plug-in installation:
[Email protected] ~]# cd/usr/local/src/
Download Percona RPM Package, here is the download is 1.1.7 version of the
[Email protected] src]# 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
Install the Percona RPM package and install the PHP plugin
[[email protected] src] #rpm-ivh percona-zabbix-templates-1.1.7-2.noarch.rpm [[email protected] src] #yum install Percona-zabbix-templates PHP php-mysql–y
2. Enter the templates directory and copy the template file to the ZABBIX_AGENTD.CONF.D directory:
[Email protected] src]# cd/var/lib/zabbix/percona/templates[[email protected] templates]# Lsuserparameter_percona_ mysql.conf Zabbix_agent_template_percona_mysql_server_ht_2.0.9-sver1.1.7.xml[[email Prot Ected] templates]# CP userparameter_percona_mysql.conf/usr/local/zabbix/etc/zabbix_agentd.conf.d/
3. Edit configuration file/usr/local/zabbix/etc/zabbix_agentd.conf, add template file path
[Email protected] templates]# vim/usr/local/zabbix/etc/zabbix_agentd.confinclude=/usr/local/zabbix/etc/zabbix_ agentd.conf.d/
4, modify the MySQL execution command file, change the MySQL user and password:
[Email protected] templates]# vim/var/lib/zabbix/percona/scripts/get_mysql_stats_wrapper.sh
Res= ' Home=~zabbix /usr/bin/mysql-uroot-pzabbix -E ' SHOW SLAVE status\g ' | Egrep ' (slave_io_running| slave_sql_running): ' | Awk-f: ' {print $} ' | Tr ' \ n ', ' '
5, modify the ss_get_mysql_stats.php file, set the MySQL user name and password, the user password is local;
[Email protected] templates]# vim/var/lib/zabbix/percona/scripts/ss_get_mysql_stats.php
$mysql _user = 'root';
$mysql _pass = 'Zabbix';
6. Restart the Zabbix client
[Email protected] templates]#/etc/init.d/zabbix_agentd restart
7. Add MySQL monitoring to the Zabbix monitoring page and select Percona MySQL Server template template:--> Configure –-> templates –-> import –-> Select File –-> import, shown in 1
Note: This zabbix_agent_template_percona_mysql_server_ht_2.0.9-sver1.1.7.xml file is in the/var/lib/zabbix/percona/templates directory, Download to the desktop upload just fine.
Figure 1
8, the import error appears "label invalid"/zabbix_export/date ":" Yyyy-mm-ddthh:mm:ssz "expected", 2 shows:
Figure 2
Solution: Baidu said the Zabbix_agent_template_percona_mysql_server_ht_2.0.9-sver1.1.7.xml import zabbix2.4 version of the re-export. After importing the new export XML into 3.2, the problem is resolved.
I already have an import success XML here, as if I can't find an attachment upload here.
9, after the successful import can be found template Percona MySQL server already exists, 3 shows:
You can find that the self-brought monitoring items are more than 100, graphics more than 40.
Figure 3
10, view the monitoring image, out of data 4, Figure 5 shows:
Figure 4
Figure 5
Zabbix with plugin Percona monitor MySQL data