编辑 Percona.repo:

vi /etc/yum.repos.d/Percona.repo

添加以下内容:

[percona]

name = CentOS $releasever - Percona

baseurl=http://repo.percona.com/centos/$releasever/os/$basearch/

enabled = 1

gpgkey = file:///etc/pki/rpm-gpg/RPM-GPG-KEY-percona

gpgcheck = 1

获取 RPM-GPG-KEY:

wget http://www.percona.com/downloads/RPM-GPG-KEY-percona -O /etc/pki/rpm-gpg/RPM-GPG-KEY-percona

检查是否添加成功:

yum list | grep percona

yum install percona-zabbix-templates

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

service zabbix-agent restart

vi /var/lib/zabbix/percona/scripts/ss_get_mysql_stats.php.cnf

添加数据库用户名密码

<?php

$mysql_user = 'root';

$mysql_pass = 's3cret';

测试脚本是否正常

[root@centos6 main]# /var/lib/zabbix/percona/scripts/get_mysql_stats_wrapper.sh gg

405647

vi /etc/zabbix/.my.cnf

添加数据库用户名密码

[client]

user = root

password = s3cret

测试脚本是否正常

[root@centos6 ~]# sudo -u zabbix -H /var/lib/zabbix/percona/scripts/get_mysql_stats_wrapper.sh running-slave

0

zabbix导入percona监控模板,勾选聚合图形