zabbix_get -s 10.10.10.10 -p10050 -k"mysql.version"

错误1:

sh: mysql: command not found

 

解决:编辑文件 userparameter_mysql.conf ,将执行命令 mysql、mysqladmin 加上完整路径,如下图:

vim /etc/zabbix/zabbix_agentd.d/userparameter_mysql.conf

Zabbix 使用 zabbix_get 测试 MySQL 错误_vim

 

错误2:

ZBX_NOTSUPPORTED: Timeout while executing a shell script

 

解决:编辑代理配置文件 zabbix_agentd.conf ,将 Timeout 改为 10(秒)

vim /etc/zabbix/zabbix_agentd.conf
### Option: Timeout
# Spend no more than Timeout seconds on processing
#
# Mandatory: no
# Range: 1-30
# Default:
Timeout=10

 

最后,重启代理,执行结果如下:

# systemctl restart zabbix-agent
# zabbix_get -s 10.10.10.10 -p10050 -k"mysql.version"
/usr/local/mysql/bin/mysql Ver 14.14 Distrib 5.7.22, for linux-glibc2.12 (x86_64) using EditLine wrapper