1、添加mysql监控账号
grant usage on *.* to ‘mysqlcheck’@’localhost’ identified by ‘mysqlcheck’;
flush privileges;
2、在/usr/local/zabbix/etc目录下创建.my.cnf
[mysql]
host = localhost
user = mysqlcheck
password = mysqlcheck
[mysqladmin]
host = localhost
user = mysqlcheck
password = mysqlcheck
3、复制mysql模板userparameter_mysql.conf需要用到的key到/usr/local/zabbix/etc/zabbix_agentd.conf.d/目录下。
文件在Zabbix的安装包可以找到
# cp /home/zabbixinstall/zabbix-2.4.7/conf/zabbix_agentd/userparameter_mysql.conf /usr/local/zabbix/etc/zabbix_agentd.conf.d
4、讲userparameter_mysql.conf中所有HOME=/var/lib/zabbix全部改成HOME=/usr/local/zabbix/etc
5、修改zabbix_agentd.conf文件
将此条的注释取消Include=/usr/local/zabbix/etc/zabbix_agentd.conf.d/
6、重启zabbix_agentd 套上Template App MySQL 模板
测试获取mysql监控数据
/usr/local/zabbix/bin/zabbix_get -s localhost -k mysql.status[Com_begin]
575660
7、效果图