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