Last active
March 18, 2024 09:38
-
-
Save plutocrat/31d43d125ed64954fa2f575ccac40448 to your computer and use it in GitHub Desktop.
Grabs a few performance / info command line tools from around the web
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# wget -O install_perftools.sh https://gist.github.com/plutocrat/31d43d125ed64954fa2f575ccac40448/raw/ && chmod 700 install_perftools.sh | |
# Get mysqltuner | |
wget -O mysqltuner.pl https://raw.githubusercontent.com/major/MySQLTuner-perl/master/mysqltuner.pl | |
wget -O basic_passwords.txt https://raw.githubusercontent.com/major/MySQLTuner-perl/master/basic_passwords.txt | |
wget -O vulnerabilities.csv https://raw.githubusercontent.com/major/MySQLTuner-perl/master/vulnerabilities.csv | |
chmod 700 mysqltuner.pl | |
sed -i 's/"skippassword" => 0,/"skippassword" => 1,/' mysqltuner.pl | |
# Get Python memory | |
wget -O ps_mem.py https://raw.githubusercontent.com/pixelb/ps_mem/master/ps_mem.py | |
chmod 700 ps_mem.py | |
# Create swapfile examiner | |
cat << 'EOF' > whats_swapping.sh | |
#!/bin/bash | |
for file in /proc/*/status ; do awk '/VmSwap|Name/{printf $2 " " $3}END{ print ""}' $file; done | sort -k 2 -n -r | head -n 20 | |
EOF | |
chmod 700 whats_swapping.sh | |
# inxi for general info | |
wget -Nc smxi.org/inxi | |
chmod 700 inxi | |
######### alt db mem script | |
cat << 'EOF' > db_mem.sh | |
#!/bin/sh | |
# you might want to add some user authentication here | |
mysql -e "show variables; show status" | awk ' | |
{ | |
VAR[$1]=$2 | |
} | |
END { | |
MAX_CONN = VAR["max_connections"] | |
MAX_USED_CONN = VAR["Max_used_connections"] | |
BASE_MEM=VAR["key_buffer_size"] + VAR["query_cache_size"] + VAR["innodb_buffer_pool_size"] + VAR["innodb_additional_mem_pool_size"] + VAR["innodb_log_buffer_size"] | |
MEM_PER_CONN=VAR["read_buffer_size"] + VAR["read_rnd_buffer_size"] + VAR["sort_buffer_size"] + VAR["join_buffer_size"] + VAR["binlog_cache_size"] + VAR["thread_stack"] + VAR["tmp_table_size"] | |
MEM_TOTAL_MIN=BASE_MEM + MEM_PER_CONN*MAX_USED_CONN | |
MEM_TOTAL_MAX=BASE_MEM + MEM_PER_CONN*MAX_CONN | |
printf "+------------------------------------------+--------------------+\n" | |
printf "| %40s | %15.3f MB |\n", "key_buffer_size", VAR["key_buffer_size"]/1048576 | |
printf "| %40s | %15.3f MB |\n", "query_cache_size", VAR["query_cache_size"]/1048576 | |
printf "| %40s | %15.3f MB |\n", "innodb_buffer_pool_size", VAR["innodb_buffer_pool_size"]/1048576 | |
printf "| %40s | %15.3f MB |\n", "innodb_additional_mem_pool_size", VAR["innodb_additional_mem_pool_size"]/1048576 | |
printf "| %40s | %15.3f MB |\n", "innodb_log_buffer_size", VAR["innodb_log_buffer_size"]/1048576 | |
printf "+------------------------------------------+--------------------+\n" | |
printf "| %40s | %15.3f MB |\n", "BASE MEMORY", BASE_MEM/1048576 | |
printf "+------------------------------------------+--------------------+\n" | |
printf "| %40s | %15.3f MB |\n", "sort_buffer_size", VAR["sort_buffer_size"]/1048576 | |
printf "| %40s | %15.3f MB |\n", "read_buffer_size", VAR["read_buffer_size"]/1048576 | |
printf "| %40s | %15.3f MB |\n", "read_rnd_buffer_size", VAR["read_rnd_buffer_size"]/1048576 | |
printf "| %40s | %15.3f MB |\n", "join_buffer_size", VAR["join_buffer_size"]/1048576 | |
printf "| %40s | %15.3f MB |\n", "thread_stack", VAR["thread_stack"]/1048576 | |
printf "| %40s | %15.3f MB |\n", "binlog_cache_size", VAR["binlog_cache_size"]/1048576 | |
printf "| %40s | %15.3f MB |\n", "tmp_table_size", VAR["tmp_table_size"]/1048576 | |
printf "+------------------------------------------+--------------------+\n" | |
printf "| %40s | %15.3f MB |\n", "MEMORY PER CONNECTION", MEM_PER_CONN/1048576 | |
printf "+------------------------------------------+--------------------+\n" | |
printf "| %40s | %18d |\n", "Max_used_connections", MAX_USED_CONN | |
printf "| %40s | %18d |\n", "max_connections", MAX_CONN | |
printf "+------------------------------------------+--------------------+\n" | |
printf "| %40s | %15.3f MB |\n", "TOTAL (MIN)", MEM_TOTAL_MIN/1048576 | |
printf "| %40s | %15.3f MB |\n", "TOTAL (MAX)", MEM_TOTAL_MAX/1048576 | |
printf "+------------------------------------------+--------------------+\n" | |
}' | |
EOF | |
chmod 700 db_mem.sh | |
# ApacheBuddy | |
wget -O apache2buddy.pl https://raw.githubusercontent.com/richardforth/apache2buddy/master/apache2buddy.pl | |
chmod 700 apache2buddy.pl | |
# SSL Test tool | |
curl -L https://testssl.sh > testssl.sh https://raw.githubusercontent.com/BMDan/tuning-primer.sh/main/tuning-primer.sh | |
chmod 700 testssl.sh | |
# Mysql Tuning primer is back | |
wget -O tuning_primer.sh https://raw.githubusercontent.com/BMDan/tuning-primer.sh/main/tuning-primer.sh | |
chmod 700 tuning_primer.sh | |
# Bandwhich | |
curl -s https://api.github.com/repos/imsnif/bandwhich/releases/latest | grep "browser_download_url.*unknown-linux-gnu.tar.gz" | cut -d : -f 2,3 | tr -d \" | wget -i - | |
tar -xvf bandwhich-*-unknown-linux-gnu.tar.gz | |
rm bandwhich-*-unknown-linux-gnu.tar.gz | |
chmod +x ./bandwhich | |
# Percona tools | |
wget -O pt-summary http://percona.com/get/pt-summary | |
wget -O pt-mysql-summary http://percona.com/get/pt-mysql-summary | |
wget -O pt-stalk http://percona.com/get/pt-stalk | |
chmod 700 pt-summary | |
chmod 700 pt-mysql-summary | |
chmod 700 pt-stalk | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment