0
我想檢查mysql查詢輸出並將結果與我的Nagios服務檢查的一些值進行比較。
它可以是有解決這個更好的方式(如果有的話 - 請您分享:))... 現在,我想這個方法:check_mysql_health - 如何檢查非數字輸出
./check_mysql_health --username root --password MyPassw0rd --mode sql --name 'show variables like 'max_connections'' --name2 "max_connections 4096"
PS:我的max_connections值4096
mysql -Bse "show variables like 'max_connections';"
max_connections 4096
輸出是:
Use of uninitialized value $value in numeric gt (>) at ./check_mysql_health line 1237.
Use of uninitialized value $value in numeric gt (>) at ./check_mysql_health line 1238.
OK - max_connections 4096:
如果我在NAME2改變價值的東西不等於 「MAX_CONNECTIONS 4096」,像 「G1Li」 號e輸出以OK狀態返回。
./check_mysql_health --username root --password MyPassw0rd --mode sql --name 'show variables like 'max_connections'' --name2 "G1Li"
Use of uninitialized value $value in numeric gt (>) at ./check_mysql_health
line 1237.
Use of uninitialized value $value in numeric gt (>) at ./check_mysql_health line 1238.
OK - g1li:
# echo $?
0
任何想法?
吉利
可能是這樣的:'--name'顯示像'max_connections'''這樣的變量。 sql裏面的引號是終止bash字符串的,所以''''''''參數''''''''''使得max_connections等成爲完全獨立的東西。 –