######以下操作均在zabbix_agentd客户端上操作

1.授权监控mysql用户
mysql -uroot -ptest #登录到mysql服务
mysql>GRANT USAGE ON . TO test@’localhost’ IDENTIFIED BY ‘test’;
mysql> flush privileges;

2.复制zabbix mysql监控配置文件
cp /root/down/zabbix-3.0.0alpha6/conf/zabbix_agentd/userparameter_mysql.conf /usr/local/zabbix/etc/zabbix_agentd.conf.d/

vi /usr/local/zabbix/etc/zabbix_agentd.conf
UnsafeUserParameters=1
Include=/usr/local/zabbix/etc/zabbix_agentd.conf.d/

3.配置userparameter_mysql.conf和my.cnf
cd /usr/local/zabbix/etc/zabbix_agentd.conf.d/
grep -v “^#” userparameter_mysql.conf >> aa.txt&&mv aa.txt userparameter_mysql.conf #过滤注释符号

sed -i ‘s|/var/lib/zabbix|/usr/local/zabbix/etc|g’ /usr/local/zabbix/etc/zabbix_agentd.conf.d/
#将/var/lib/zabbix 替换为/usr/local/zabbix/etc,也可以手动将HOME后面目录替换为你放.my.cnf目录

vi userparameter_mysql.conf
将mysql -N,mysqladmin ping,mysql -V 修改为/usr/local/mysql/bin/mysql和/usr/local/mysql/bin/mysqladmin
#/usr/local/mysql/bin/为mysql实际安装bin目录

vi /usr/local/zabbix/etc/.my.cnf #监控用户的账户名和密码
[client]
user=test
password=test

chmod a+rx /usr/local/zabbix/etc/.my.cnf
chmod a+rx /usr/local/zabbix/etc/zabbix_agentd.conf.d/userparameter_mysql.conf

4.重启zabbix_agentd服务
service zabbix_agentd stop

service zabbix_agentd start

5.zabbix_server服务端web页面添加mysql监控模板

发表评论

您的电子邮箱地址不会被公开。 必填项已用*标注

Captcha Code