1. 程式人生 > >zabbix監控mysql之Warning: Using a password on the command line interface can be insecure.

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

command fff agentd ack warning using 5.6 mys 方法

今天在添加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}‘

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