Monitor MySQL with Percona plugin
We used to monitor MySQL or mariadb status by customizing the monitoring items, but if we need more detailed types of monitoring or do not want to create a series of monitoring projects ourselves, we can use the monitoring items in the Percona plugin to realize MySQL monitoring. This saves us a lot of manual operation.
Install the PHP environment and Percona plugin:
Yum Install PHP PHP-MYSQL–YRPM-IVH https://www.percona.com/downloads/percona-monitoring-plugins/ percona-monitoring-plugins-1.1.7/binary/redhat/7/x86_64/percona-zabbix-templates-1.1.7-2.noarch.rpm
After the plug-in installation is complete, you will be prompted as follows:
Scripts is installed to/var/lib/zabbix/percona/scriptstemplates is installed To/var/lib/zabbix/percona/templates
There will be two files in the templates directory:
[[email protected] ~]# cd/var/lib/zabbix/percona/templates[[email protected] templates]# lltotal 284-rw-r--r--1 root ro OT 18866 Dec userparameter_percona_mysql.conf-rw-r--r--1 root root 269258 Dec zabbix_agent_template_pe Rcona_mysql_server_ht_2.0.9-sver1.1.7.xml
Where the Userparameter file requires us to copy to the directory specified in the corresponding ZABBX agent configuration. Default is/etc/zabbix/zabbix_agentd.d/
The template file needs to be imported into the Zabbix template, which defines all the monitoring rules.
In scripts, there are also two files:
[Email protected] scripts]# lltotal 64-rwxr-xr-x 1 root root 1251 Dec get_mysql_stats_wrapper.sh-rwxr-xr-x 1 ro OT root 59998 Nov 15:55 ss_get_mysql_stats.php
Here you need to modify the PHP file specified in the database account, password and sock file path, the default is a null value, pointing to the/var/lib/mysql/mysql.sock, if not the default, you need to modify:
$mysql _user = ' root '; $mysql _pass = ' 123456 '; $mysql _port = 3306; $mysql _socket = '/data/mariadata/mysql/mysql.sock ';
Test commands are available:
[Email protected] scripts]#/get_mysql_stats_wrapper.sh gg48
Web Interface import template, if too many monitoring items can delete unwanted monitoring items. Attach the monitor template http://down.51cto.com/data/2340474.
This article is from the "Trying" blog, make sure to keep this source http://tryingstuff.blog.51cto.com/4603492/1981296
Zabbix using Percona plugin to monitor MySQL