Browse Source

Added ee import-slow-log command

old-stable
gau1991 10 years ago
parent
commit
6f3e7d067a
  1. 4
      bin/easyengine
  2. 23
      src/lib/ee_lib_import_slow_log.sh

4
bin/easyengine

@ -736,8 +736,10 @@ elif [ "$EE_FIRST" = "secure" ]; then
# Clean cache # Clean cache
elif [ "$EE_FIRST" = "clean" ]; then elif [ "$EE_FIRST" = "clean" ]; then
ee_mod_clean ${@:2} ee_mod_clean ${@:2}
elif [ "$EE_FIRST" = "import-slow-log"];then
ee_lib_import_slow_log
# EasyEngine update # EasyEngine update
elif [ "$EE_FIRST" = "update" ]; then elif [ "$EE_FIRST" = "update" ]; then

23
src/lib/ee_lib_import_slow_log.sh

@ -3,15 +3,20 @@
function ee_lib_import_slow_log() function ee_lib_import_slow_log()
{ {
dpkg --compare-versions $(pt-query-digest --version | awk '{print $2 }') ge 2.2 if [ -d /var/www/22222/htdocs/db/anemometer ]; then
if [ $? -eq 0 ]; then ee_lib_echo "Importing MySQL slow log, please wait..."
ee_anemometer_history=history 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 else
ee_anemometer_history=review-history ee_lib_echo_fail "Anememoter is not installed"
fi 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
} }

Loading…
Cancel
Save