zabbix使用percona监控mysql
1.插件是php写的需要安装 php与php-mysql
yum install php php-mysql
2.下载percona-zabbix-templates
3.解压包
rpm -ivh percona-zabbix-templates-1.1.6-1.noarch.rpm
默认解压再/var/lib/zabbix下含有两个目录 一个是脚本一个是模板

4.添加授权用户登录mysql
mysql > grant select,process,replication client on *.* to 'zabbix'@'%' identified by '123456';
mysql > flush privileges;
5.修改mysql登录信息
vim get_mysql_stats_wrapper.sh
修改19行 加入 mysql -uzabbix-p123456
修改host


6.修改数据库登录信息
vim ss_get_mysql_stats.php
$mysql_user = 'cactiuser';
$mysql_pass = 'cactiuser';
修改为
$mysql_user = 'zabbix';
$mysql_pass = '123456';

7.赋值自定义监控的配置文件到zabbix_gentd.d

8.查看自定义key

9.测试脚本是否可用
/var/lib/zabbix/percona/scripts/get_mysql_stats_wrapper.sh gg
在server端测试:
/usr/local/zabbix/bin/zabbix_get -s ip -k"MySQL max-connections"
10.重启agent
systemctl restart zabbix-agent
导入模板


10.添加主机监控项
