码迷,mamicode.com
首页 > 数据库 > 详细

Zabbix 3 中使用 Percona Monitoring Plugins 监控 MySQL

时间:2017-07-25 19:57:59      阅读:200      评论:0      收藏:0      [点我收藏+]

标签:zabbix

1、安装监控插件

wget https://www.percona.com/downloads/percona-monitoring-plugins/percona-monitoring-plugins-1.1.7/binary/redhat/6/x86_64/percona-zabbix-templates-1.1.7-2.noarch.rpm

rpm -ivh percona-zabbix-templates-1.1.7-2.noarch.rpm 

yum install percona-zabbix-templates php php-mysql -y


2、修改zabbix agent配置文件

cp /var/lib/zabbix/percona/templates/userparameter_percona_mysql.conf /usr/local/zabbix/etc/zabbix_agentd.conf.d/

vim /usr/local/zabbix/etc/zabbix_agentd.conf

Include=/usr/local/zabbix/etc/zabbix_agentd.conf.d/

killall -9 zabbix_agentd

/usr/local/zabbix/sbin/zabbix_agentd


3、创建mysql账号

mysql> GRANT SELECT,PROCESS,SUPER,REPLICATION CLIENT ON *.* TO ‘zabbixmoniter‘@‘localhost‘ IDENTIFIED BY "123456";

mysql> flush privileges;


4、修改插件配置文件

vim /var/lib/zabbix/percona/scripts/ss_get_mysql_stats.php

$mysql_user = ‘zabbixmoniter‘;

$mysql_pass = ‘123456‘;

$mysql_port = 3306;

$mysql_socket = ‘/tmp/mysql.sock‘;

5、创建zabbix用户MySQL用户账号(监控slave用)

su - zabbix

vim ~/.my.cnf 

[client]

user = zabbixmoniter

password = 123456

socket = /tmp/mysql.sock


6、测试slave

su - zabbix

sh /var/lib/zabbix/percona/scripts/get_mysql_stats_wrapper.sh running-slave


7、导入模板

模板下载地址:

http://jaminzhang.github.io/soft-conf/Zabbix/zbx_percona_mysql_template.xml


参考博文:

http://www.ywnds.com/?p=6199

http://10880347.blog.51cto.com/346720/1932100

http://jaminzhang.github.io/monitoring/Monitoring-MySQL-using-Percona-Monitoring-Plugins-in-Zabbix/


Zabbix 3 中使用 Percona Monitoring Plugins 监控 MySQL

标签:zabbix

原文地址:http://linux10000.blog.51cto.com/6338282/1950862

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!