需要如下配置:
1,数据库授权获取数据的用户
grant select on . to zabbixmonitor@"localhost" identified by "zabbixmonitor";
flush privileges;
2,配置文件
vim /etc/zabbix/.my.cnf
[client]
hostname = localhost
user = zabbixmonitor
password = zabbixmonitor
3,/etc/zabbix/zabbix_agentd.d/userparameter_mysql.conf
a,由于这里写的mysql的命令是相对路径,如果阁下是编译安装,请写绝对路径
which mysql -------------------- 如若不然会报command not found
b,更改配置文件的家目录为:/etc/zabbix
sed -i ‘s#/var/lib/zabbix#/etc/zabbix#g‘ /etc/zabbix/zabbix_agentd.d/userparameter_mysql.conf
4,重启客户端
systemctl restart zabbix-agent