fix issue when dealing with MySQL
paulfantom committed
Jun 15, 2016 at 23:24 UTC
7ee587c5d77f3b7cb7f63e12ca1fc9435471d95c
1 file changed
+2
-1
charts.d/mysql.chart.sh
+2
-1
@@ -17,7 +17,8 @@ mysql_get() {
17
local oIFS="${IFS}"
18
mysql_data=()
19
IFS=$'\t'$'\n'
20
- arr=($("${@}" -e "SHOW GLOBAL STATUS WHERE value REGEXP '^[0-9]';" | egrep "^(Bytes|Slow_|Que|Handl|Table|Selec|Sort_|Creat|Conne|Abort|Binlo|Threa|Innod|Qcach|Key_|Open)" ))
20
+ #arr=($("${@}" -e "SHOW GLOBAL STATUS WHERE value REGEXP '^[0-9]';" | egrep "^(Bytes|Slow_|Que|Handl|Table|Selec|Sort_|Creat|Conne|Abort|Binlo|Threa|Innod|Qcach|Key_|Open)" ))
21
+ arr=($("${@}" -N -e "SHOW GLOBAL STATUS;" | egrep "^(Bytes|Slow_|Que|Handl|Table|Selec|Sort_|Creat|Conne|Abort|Binlo|Threa|Innod|Qcach|Key_|Open)[^ ]+\s[0-9]" ))
22
IFS="${oIFS}"
23
24
[ "${#arr[@]}" -lt 3 ] && return 1