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等成为完全独立的东西。 –