I. Environmental description
Zabbix 2.2 in Centos 6.4 64bit
Two, MPM (MySQL performance Monitor) installation
1. Dependent modules
Yum install Perl-file-which perl-libwww-perl perl-digest-sha1 perl-dbd-mysql perl-time-hires Perl-Crypt-SSLeay
2. MPM Installation Deployment
Wget-c http://www.shinguz.ch/download/mysql_performance_monitor-latest.tar.gz
Decompression source package, divided into two parts, part of the template needs to be imported in the Zabbix platform, part of the collection program
#tar-ZXVF mysql_performance_monitor-latest.tar.gz
Mysql_performance_monitor_agent-0.9.1.tar.gz #采集程序
Mysql_performance_monitor_templates-0.9.1.tar.gz #模板
Unzip the template and import the Zabbix platform
#tar-ZXVF mysql_performance_monitor_templates-0.9.1.tar.gz
Template_FromDual.MySQL.mpm.xml (monitor the MPM agent itself, this must be imported)
Template_FromDual.MySQL.server.xml (monitor the Linux system for additional items related to database usage)
Template_FromDual.MySQL.process.xml (monitoring various Linux processes [e.g.: MYSQLD,NDBD])
Template_FromDual.MySQL.mysql.xml (monitor MySQL common state variables)
Template_FromDual.MySQL.innodb.xml (Monitoring InnoDB storage engine state variables)
Template_FromDual.MySQL.myisam.xml (Monitoring MyISAM storage engine state variables)
Template_FromDual.MySQL.master.xml (monitor MySQL Master State for master-slave replication)
Template_FromDual.MySQL.slave.xml (Monitoring the slave status of MySQL master-slave replication)
Template_FromDual.MySQL.ndb.xml (monitor MySQL Cluster)
Template_FromDual.MySQL.galera.xml (monitor MySQL galera Cluster)
Template_FromDual.MySQL.pbxt.xml (Monitoring PBXT storage engine state variables)
Template_FromDual.MySQL.aria.xml (Monitoring the status variables of the ARIA storage Engine)
Template_FromDual.MySQL.drbd.xml (Monitoring DRBD device status information)
- MPM Agent Installation
- # tar zxvf mysql_performance_monitor_agent-0.9.1.tar.gz
# MV MYSQL_PERFORMANCE_MONITOR_AGENT-0.9.1/USR/LOCAL/ZABBIX/SCRIPT/MPM
To modify the path of Zabbix_sender in fromdualmysqlagent.pl:
cd/usr/local/zabbix/script/mpm
Sed-i ' S|/usr/local/bin|/usr/local/zabbix/bin/|g ' fromdualmysqlagent.pl
Modifying a configuration file
Cp/usr/local/zabbix/script/mpm/etc/fromdualmysqlagent.conf.template/usr/local/zabbix/etc/zabbix_mpm.conf
Cat zabbix_mpm.conf
[Default]
Type = mysqld
Debug = 2
LogFile =/var/log/zabbix/fromdualmysqlagent.log
# Directory where the Cache files should is written to:
Cachefilebase =/var/log/zabbix/cache/fromdualagentcache
# Information for MySQL connections:
Username = user
Password = Password
Mysqlhost = 127.0.0.1
Mysqlport = 3306
# Zabbix Server IP Address
Zabbixserver = 10.6.9.8
# If section is disabled
Disabled = False
Modules = Process MySQL MyISAM innodb
# special parameter which is used for module NDB and process
Clusterlog =/var/lib/mysql-cluster/ndb_1_cluster.log
Pidfile =/var/lib/mysql/mysqld.pid
# all MySQL databases here
# Try to avoid sections names with spaces!
[10.58.50.49] # This must match Hostname in zabbix!
Type = mysqld
Mysqlport = 3306
Modules = process MySQL MyISAM slave
Pidfile =/data/mysql/data/mysql.pid #mysql server pid
Add MPM to Zabbix_agentd.conf
##*****mysql performance**********
userparameter=fromdual.mysql.check,/usr/local/zabbix/script/mpm/fromdualmysqlagent.pl/usr/local/zabbix/etc/ Zabbix_mpm.conf
New log Directory
# mkdir-p/var/log/zabbix/cache
# Create log files manually:
#touch/var/log/zabbix/fromdualmysqlagent.log
# Modify Directory Permissions:
#chown zabbix.zabbix/var/log/zabbix/-R
#chmod o+r /data/mysql/data/mysql.pid
Restart Zabbix agentd
/etc/init.d/zabbix_agentd restart
Test:
#/usr/local/zabbix/script/mpm/fromdualmysqlagent.pl/usr/local/zabbix/etc/zabbix_mpm.conf
The return value is 1: The MPM plug-in is normal, restart the zabbix_agent, load the MPM plugin
3. Error handling
<1> warn
vim/usr/local/zabbix/script/mpm/lib/senddata.pm
# comment out the following statement:
$RC =&fromdualmysqlagent::checkconnectiontozabbixserver ($main:: gparameter{' Zabbixserver '}, $main:: GParameter {' Zabbixserverport '}, $main:: gparameter{' Hostname '});
This article is from the "Seagrass" blog, please be sure to keep this source http://961911.blog.51cto.com/951911/1568491
Zabbix MPM monitoring MySQL Performance