今天在添加zabbix对2台mysql服务器监控的时候,其中有一台的item报如下错误:
Value "Warning: Using a password on the command line interface can be insecure.6158" of type "string" is not suitable for value type "Numeric(unsigned)"
我设置的获取的值类型是数字格式,2台机器用的同一个模版的key取值,但为什么有一台接收到的是string格式。
web中的item里我设置的Type of information:Numeric (unsigned)
zabbix_agentd.conf里key写的 UserParameter=mysql.status[*],echo "show global status where Variable_name='$1';" | mysql -u zabbix -pzabbix -N | awk '{print $$2}'
后来发现这2台mysql版本不一样。。。一台是5.5,一台是5.6。
在5.6以上版本的时候用mysql相关命令-p后面接密码这种方式会有一个警告提示(Warning: Using a password on the command line interface can be insecure.),这是安全风险提示。
这样zabbix服务端使用表达式过滤获取数值的时候,会带有该字符串,导致item获取值类型错误。。。
解决方法:
在key中用 2>/dev/null把这段告警忽略掉。
UserParameter=mysql.status[*],echo "show global status where Variable_name='$1';" | mysql -u zabbix -pzabbix -N 2>/dev/null| awk '{print $$2}'
本文记录了在使用Zabbix监控两台不同版本MySQL服务器时遇到的问题,详细描述了一台服务器因版本差异导致监控项类型错误的情况及解决方法。
1万+

被折叠的 条评论
为什么被折叠?



