|
|
@ -3,15 +3,20 @@ |
|
|
|
function ee_lib_import_slow_log() |
|
|
|
{ |
|
|
|
|
|
|
|
dpkg --compare-versions $(pt-query-digest --version | awk '{print $2 }') ge 2.2 |
|
|
|
if [ $? -eq 0 ]; then |
|
|
|
ee_anemometer_history=history |
|
|
|
if [ -d /var/www/22222/htdocs/db/anemometer ]; then |
|
|
|
ee_lib_echo "Importing MySQL slow log, please wait..." |
|
|
|
dpkg --compare-versions $(pt-query-digest --version | awk '{print $2 }') ge 2.2 |
|
|
|
if [ $? -eq 0 ]; then |
|
|
|
ee_anemometer_history=history |
|
|
|
else |
|
|
|
ee_anemometer_history=review-history |
|
|
|
fi |
|
|
|
|
|
|
|
pt-query-digest --user=anemometer --password=anemometer_password \ |
|
|
|
--review D=slow_query_log,t=global_query_review \ |
|
|
|
--${ee_anemometer_history} D=slow_query_log,t=global_query_review_history \ |
|
|
|
--no-report --limit=0% --filter=" \$event->{Bytes} = length(\$event->{arg}) and \$event->{hostname}=\"$EE_MYSQL_GRANT_HOST\"" /var/log/mysql/mysql-slow.log |
|
|
|
else |
|
|
|
ee_anemometer_history=review-history |
|
|
|
ee_lib_echo_fail "Anememoter is not installed" |
|
|
|
fi |
|
|
|
|
|
|
|
pt-query-digest --user=anemometer --password=anemometer_password \ |
|
|
|
--review D=slow_query_log,t=global_query_review \ |
|
|
|
--${ee_anemometer_history} D=slow_query_log,t=global_query_review_history \ |
|
|
|
--no-report --limit=0% --filter=" \$event->{Bytes} = length(\$event->{arg}) and \$event->{hostname}=\"$EE_MYSQL_GRANT_HOST\"" /var/log/mysql/mysql-slow.log |
|
|
|
} |
|
|
|