zabbix监控mysql之Warning: Using a password on the command line interface can be insecure.

今天在添加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里我设置的

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}'

猜你喜欢

转载自www.cnblogs.com/xingxiz/p/9371289.html
今日推荐