1. 程式人生 > >Warning: Using a password on the command line inte

Warning: Using a password on the command line inte

The null sta zabbix use warn man sele res

使用zabbix自帶模板對mysql進行監控時,發現mysql5.6以上版本在使用mysqladmin時會發出警告:“Warning: Using a password on the command line interface can be insecure.” 。這樣zabbix服務端獲取數值的時候,會帶有該字符串,導致報錯。

最後實驗成功的方法是:將mysqladmin的警告信息重定向到/dev/null,忽略掉告警信息。

Com_select)

    result=`/usr/bin/mysqladmin -u$MYSQL_USER -h$MYSQL_HOST -p${MYSQL_PWD} -S $MYSQL_SOCK extended-status  2>/dev/null|grep -w "Com_select"|cut -d"|" -f3`

            echo $result

            ;;

在原有命令中加上2>/dev/null 就行了。

Warning: Using a password on the command line inte