Mysql monitoring tool: zabbix + MPM (PerformanceMonitorforMySQL)
MPM is mainly used to monitor various mysql parameter performance indicators. The following describes the configuration of MPM and zabbix:
The following figure shows the configuration file diagram.
It consists of two parts:
1. zabbix template: Template_FromDual.MySQL. *. xml
2. MPM agent perl module: FromDualMySQL *. pm
Installation Method:
1. Install MPM first
In linux 6.4, install the following package:
Yum install perl-File-Which perl-libwww-perl-Digest-SHA perl-DBD-MySQL perl-Time-HiRes \
Perl-Crypt-SSLeay
Decompress the downloaded package:
Tar xf mysql_performance_monitor-latest.tar.gz
Tar xf mysql_performance_monitor_templates-latest.tar.gz
Mysql_performance_monitor_templates-latest.tar.gz is imported to the zabbix servertemplate as needed. mysql_performance_monitor-latest.tar.gz is decompressed and placed on the zabbix client.
2. Configure zabbix client
1. decompress the script on the client, configure the zabbix_agentd.conf file, and add the following content:
UserParameter = FromDual. MySQL. check,/opt/mysql_cece_monitor_agent/FromDualMySQLagent. pl/etc/zabbix/FromDualMySQLagent. conf
2. cp FromDualMySQLagent. conf. template/etc/zabbix/FromDualMySQLagent. conf
And modify the relevant content:
[Default] Type = mysqldLogFile =/var/log/zabbix/FromDualMySQLagent. logUsername = rootPassword = <secret> MysqlHost = login = 3306 ZabbixServer = localhostModules = process mysql myisam innodb [<db_server>] Type = mysqldModules = mpm server [mysql1] ### this name it must be consistent with the host name added by zabbix server. Type = mysqldModules = process mysql myisam innodbPidFile =/mysql/data/mysql. pid # mysql server pid
The following are the permissions required to monitor the user in the mysql database:
Create user 'mpm' @ '127. 0.0.1 'identified by 'mpmsecret ';
Grant process on *. * TO 'mpm' @ '2017. 0.0.1 ';
Grant replication client on *. * TO 'mpm' @ '2017. 0.0.1 ';
3. Create related directories and files and add permissions
Mkdir-p/var/log/zabbix/cache
Chown-R zabbix:/var/log/zabbix/cache
4. Modify the path of zabbix_send in the FromDualMySQLagent. pl script.
Path of zabbix_sender in FromDualMySQLagent. pl. Sed-I's |/usr/local/bin |/usr/local/zabbix/bin/| G' FromDualMySQLagent. pl
5. start agentd and service zabbix_agentd start
3. Configure the zabbix Server
1. Import related templates. Template_FromDual.MySQL.mpm.xml is required. You can import other templates as needed;
2. Add a host and link it to the MPM template.
Note that the host name must be consistent with the Host Name of the monitored client.
Test and verification:
/Usr/local/zabbixt/mpm/FromDualMySQLagent. pl/etc/zabbix/FromDualMySQLagent. conf
1: indicates that the MPM plug-in is normal. Restart zabbix_agent and load the mpm plug-in.
You can also set it to crontab for regular monitoring.
* ***/Usr/local/zabbixt/mpm/FromDualMySQLagent. pl/etc/zabbix/FromDualMySQLagent. conf 1>/dev/null 2> & 1