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

 


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM