Zabbix and MPM monitoring MySQL
- Environment Description
A: 192.168.1.190, CentOS 6.3, Zabbix Server deployed
B: 192.168.1.191, CentOS 6.3, Zabbix Agent, MySQL 5.5.29 (MySQL Slave)
- MPM/Zabbix monitoring structure and deployment steps
MPM/Zabbix monitoring structure:
Follow these steps to monitor MySQL using MPM/Zabbix:
- Install and deploy Zabbix
- Download and install MPM (Performance Monitor for MySQL) and its dependent Perl Module
- Import an MPM Template
- Create a host group (optional)
- Create a host (the database in the MPM agent configuration)
It is worth noting that the Hostname must be consistent with the one used in the MPM agent configuration.
- Associate the selected template with the created host.
- Configure the MPM agent
- Hook "MPM agent" to Zabbix agent
# Cat/path_to_zabbix_agent_conf/zabbix_agentd.conf
UserParameter = FromDual. MySQL. check,/path_to_mpm_agent/FromDualMySQLagent. pl \
/Path_to_mpm_agent_conf/FromDualMySQLagent
- Restart Zabbix agent
- Install and deploy Zabbix
See install and deploy the distributed monitoring system Zabbix 2.06.
- MPM download and dependency Installation
Install the relevant Perl modules on which MPM (performance monitor for mysql) depends:
# yum install perl-File-Which perl-libwww-perl perl-Digest-SHA1 perl-DBD-MySQL perl-Time-HiRes perl-Crypt-SSLeay
Download and decompress MPM:
# wget -c http://www.shinguz.ch/download/mysql_performance_monitor-latest.tar.gz# tar zxvf mysql_performance_monitor-latest.tar.gz
- Zabbix Web UI import MPM Template
MPM template:
# tar zxvf mysql_performance_monitor_templates-0.9.1.tar.gz# cd mysql_performance_monitor_templates-0.9.1/xml
In the Zabbix Web UI, Import the template required for monitoring ("Configuration"-> "Templates"-> "Import "):
Template_FromDual.MySQL.mpm.xml (monitor the mpm agent itself, which must be imported)
Template_FromDual.MySQL.server.xml (additional items related to Linux and database usage)
Template_FromDual.MySQL.process.xml (monitors various Linux processes [such as mysqld, ndbd])
Template_FromDual.MySQL.mysql.xml (monitor common MySQL status variables)
Template_FromDual.MySQL.innodb.xml (Monitor InnoDB Storage engine status variables)
Template_FromDual.MySQL.myisam.xml (monitor the status variable of the MyISAM storage engine)
Template_FromDual.MySQL.master.xml (monitor the Master Status of MySQL Master-slave replication)
Template_FromDual.MySQL.slave.xml (monitor the Slave status of MySQL master-Slave replication)
Other MPM templates:
Template_FromDual.MySQL.ndb.xml (Monitoring MySQL Cluster)
Template_FromDual.MySQL.galera.xml (Monitoring MySQL Galera Cluster)
Template_FromDual.MySQL.pbxt.xml (Monitor PBXT storage engine status variables)
Template_FromDual.MySQL.aria.xml (monitor the status variables of the Aria storage engine)
Template_FromDual.MySQL.drbd.xml (monitor the status of a DRBD device)
- Install MPM and configure the Zabbix Keys of the MPM Agent
Install MPM:
# tar zxvf mysql_performance_monitor_agent-0.9.1.tar.gz# mv mysql_performance_monitor_agent-0.9.1 /usr/local/mysql_performance_monitor-agent
Modify the path of zabbix_sender in FromDualMySQLagent. pl:
# cd /usr/local/mysql_performance_monitor-agent/# sed -i 's|/usr/local/bin|/usr/local/zabbix/bin/|g' FromDualMySQLagent.pl
Add the Keys configuration of the MPM Agent to the Zabbix Agentd configuration file directory:
# cd /usr/local/zabbix/etc/zabbix_agentd.conf.d# vi FromDual_MySQL_monitoring.conf# cat FromDual_MySQL_monitoring.conf
UserParameter=FromDual.MySQL.check,/usr/local/mysql_performance_monitor-agent/FromDualMySQLagent.pl /usr/local/mysql_performance_monitor-agent/etc/FromDualMySQLagent.conf