X-Git-Url: https://arthur.barton.de/gitweb/?a=blobdiff_plain;f=charts.d%2Fmysql.chart.sh;h=30ad74ea31e159aa8dcb9e8645f1719a39b32feb;hb=7ee587c5d77f3b7cb7f63e12ca1fc9435471d95c;hp=1a3134104f56e971ce28228938d61db60b37e2e6;hpb=ec28e63c30962818dab315d64ee4da10005e47fd;p=netdata.git diff --git a/charts.d/mysql.chart.sh b/charts.d/mysql.chart.sh index 1a313410..30ad74ea 100755 --- a/charts.d/mysql.chart.sh +++ b/charts.d/mysql.chart.sh @@ -7,106 +7,30 @@ # This statement does not require any privilege. # It requires only the ability to connect to the server. -mysql_update_every=5 +mysql_update_every=2 mysql_priority=60000 -declare -A mysql_cmds=() mysql_opts=() mysql_ids=() +declare -A mysql_cmds=() mysql_opts=() mysql_ids=() mysql_data=() -mysql_exec() { - local ret - - "${@}" -s -e "show global status;" - ret=$? +mysql_get() { + local arr + local oIFS="${IFS}" + mysql_data=() + IFS=$'\t'$'\n' + #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)" )) + 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]" )) + IFS="${oIFS}" + + [ "${#arr[@]}" -lt 3 ] && return 1 + local end=${#arr[@]} + for ((i=2;i