New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
MySQL plugin question #520
Comments
I think the regular expression will be worst for the mysql server. Most values are numeric already:
Ideally, we should write this in node.js, python or even C. |
I though you would say that and that's why I'm working on a python version (I don't know node.js and my C code would probably be worse than current bash version). But for now I can reduce number of forks in 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_|Queri|Handl|Table|Selec|Sort_|Creat|Conne|Abort|Binlo|Threa|Innod|Qcach|Key_|Open)" ))
IFS="${oIFS}"
[ "${#arr[@]}" -lt 3 ] && return 1
local end=${#arr[@]}
for ((i=2;i<end;i+=2)); do
mysql_data["${arr[$i]}"]=${arr[$i+1]}
done
[ -z "${mysql_data[Connections]}" ] && return 1
mysql_data[Thread_cache_misses]=0
[ $(( mysql_data[Connections] + 1 - 1 )) -gt 0 ] && mysql_data[Thread_cache_misses]=$(( mysql_data[Threads_created] * 10000 / mysql_data[Connections] ))
return 0
} With this everything is stored in associative array Also in context to #206, does python plugin should go into |
nice! Please do so. If you remove the Keep in mind this plugin supports querying multiple mysql servers. So please test this too.
in Ideally, to avoid loading multiple python interpreters, we should have a |
Yes it does work without
In this one I haven't changed any code responsible for working on multiple servers. Python module will have the same functionality. In the next days I will try to come up with some solution of loading python modules. |
perfect! You are the best! |
As of now, do you want PR with modified mysql.chart.sh ? |
If you have it ready, yes. Why not? |
Do netdata really need to execute
SHOW GLOBAL STATUS;
in MySQL or maybe it would be better to optimize it to something likeSHOW GLOBAL STATUS WHERE value REGEXP '^[0-9]';
because we only need numeric data.If it can be changed I can make PR with a simpler and a little bit faster plugin. Although it is still in bash.
The text was updated successfully, but these errors were encountered: