/go/mysqltop looks at what MariaDB is doing right now and at the queries it has run, and it can also take action when the server is under heavy load. It: The index lists this command as "Identify the most accessed databases on a GoAdmio server". It does more than that. Every admin action in GoAdmio has a matching /go/ command, so anything you can click you can also script.
Quick start
# Show current activity, write today's reports, and react if the load is high
/go/mysqltop
Examples
# Run it
/go/mysqltop
# See the reports written today
ls /var/log/go/mysql/
head -n 20 /var/log/go/mysql/slowest-$(date +%F).log
head -n 20 /var/log/go/mysql/top-$(date +%F).log
# Check the numbers behind the load percentage
awk '{print $1}' /proc/loadavg
grep -c processor /proc/cpuinfo
# See when the automatic response ran
tail -n 5 /var/log/go/underattack.log
# Delete reports older than 30 days (the command never deletes them)
find /var/log/go/mysql \( -name 'slow-20*' -o -name 'slowest-20*' -o -name 'top-20*' \) -mtime +30 -delete
# Make the next reports cover today only (clears the statistics for all digests)
mariadb -e "TRUNCATE performance_schema.events_statements_summary_by_digest;"
Output
Each section is printed only when it has rows, and is followed by a line of dashes.
| Section | What it shows |
|---|---|
Currently Running Queries: |
ID, USER, DB, COMMAND, TIME, STATE, and INFO for every connection that has a database selected. |
Active Queries: |
The ten users with the most connections, with their counts. |
High CPU Threads: |
The ten databases with the highest total connection TIME, with their connection counts. |
The three section names are not always accurate. See Reading the screen output.
When the load is 100% or more, it also prints Turn On Under Attack Mode: <domain>.
The daily reports are written silently to files. See Daily reports.
See the full reference at /go/mysqltop and the GoAdmio command index.
GoAdmio is free and open source, with no license fees and no account limits. Read the GoAdmio docs, or see why it is a free cPanel alternative at goadmio.com.
