Zabbix + MPM 环境搭建

青纸鸢thj 发布于 2015/09/02 16:50
阅读 546
收藏 0
1.MPM下载及其依赖安装
# yum update --exclude=perl
# yum install perl-File-Which perl-libwww-perl perl-Digest-SHA perl-DBD-MySQL perl-Time-HiRes perl-Crypt-SSLeay   (依赖)
# wget -c http://www.shinguz.ch/download/mysql_performance_monitor-latest.tar.gz     (下载)
# tar zxvf mysql_performance_monitor-latest.tar.gz     (解压)
mysql_performance_monitor_templates-0.9.1.tar.gz 主要是Zabbix Server Web 端导入的模板
mysql_performance_monitor_agent-0.9.1.tar.gz Zabbix客户端需要部署的MPM客户端文件
2. Zabbix Web 端导入MPM模板
在Zabbix Web UI导入监控所需的模板(“Configuration”->”Templates”->”Import”):
Template_FromDual.MySQL.mpm.xml (监控mpm agent本身,这个必须导入)
Template_FromDual.MySQL.server.xml (监控Linux系统跟数据库使用相关的附加项)
Template_FromDual.MySQL.process.xml (监控各种Linux进程[比如:mysqld,ndbd])
Template_FromDual.MySQL.mysql.xml (监控MySQL常用状态变量)
Template_FromDual.MySQL.innodb.xml (监控InnoDB存储引擎状态变量)
Template_FromDual.MySQL.myisam.xml (监控MyISAM存储引擎状态变量)
Template_FromDual.MySQL.master.xml (监控MySQL主从复制的Master状态)
Template_FromDual.MySQL.slave.xml (监控MySQL主从复制的Slave状态)
MPM其它用途的模板:
Template_FromDual.MySQL.ndb.xml (监控MySQL Cluster)
Template_FromDual.MySQL.galera.xml (监控MySQL Galera Cluster)
Template_FromDual.MySQL.pbxt.xml (监控PBXT存储引擎状态变量)
Template_FromDual.MySQL.aria.xml (监控Aria存储引擎的状态变量)
Template_FromDual.MySQL.drbd.xml (监控DRBD设备状态信息)
点击“组态”-->"模板" -->"汇入" -->"选择文件" -->选择要上传的模板

3.安装MPM并且配置MPM Agent的Zabbix Keys,以实现Zabbix挂接MPM
 安装MPM Agent
# wget -c http://www.shinguz.ch/download/mysql_performance_monitor-latest.tar.gz
# tar zxvf mysql_performance_monitor-latest.tar.gz
# 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

在FromDualMySQLagent.pl脚本中修改相应的zabbix_sender 的路径
# cd /usr/local/mysql_performance_monitor-agent
# sed -i 's|/usr/local/bin|/usr/local/zabbix/bin/|g' FromDualMySQLagent.pl

将MPM Agent的Keys 信息加入到zabbix_agentd 的配置目录中
# 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

4.MPM Agent配置
创建MPM的MySQL监控用户
mysql> create user 'mpm'@'127.0.0.1' identified by 'mpm';
mysql> grant process, replication client on *.* to 'mpm'@'127.0.0.1';
mysql> flush privileges;

配置MPM Agent
# cd /usr/local/mysql_performance_monitor-agent/etc
# cp FromDualMySQLagent.conf.template FromDualMySQLagent.conf
# mkdir -p /var/log/zabbix
# mkdir -p /var/log/zabbix/cache
# touch /var/log/zabbix/FromDualMySQLagent.log
# chown -R zabbix:zabbix /var/log/zabbix
# chmod o+r /data/mysql_data/mysql/MySQL-2.pid
# vi FromDualMySQLagent.conf
# cat FromDualMySQLagent.conf
配置 MPMAgent

检查MPM插件工作状况
# /usr/local/mysql_performance_monitor-agent/FromDualMySQLagent.pl  /usr/local/mysql_performance_monitor-agent/etc/FromDualMySQLagent.conf


[root@MySQL-2 ~]# /usr/local/mysql_performance_monitor-agent/FromDualMySQLagent.pl  /usr/local/mysql_performance_monitor-agent/etc/FromDualMySQLagent.conf
Use of uninitialized value $pLogLevel in numeric ge (>=) at /usr/local/mysql_performance_monitor-agent/lib/FromDualMySQLagent.pm line 586.
1

zabbix没有检测成功 求大神帮忙看一下

加载中
返回顶部
顶部