標籤:use name 提示 mysql伺服器 lin suitable zabbix監控 awk 警示
今天在添加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之Warning: Using a password on the command line interface can be insecure.