Last active
February 2, 2024 09:17
Revisions
-
davidalger revised this gist
Apr 7, 2020 . 1 changed file with 1 addition and 2 deletions.There are no files selected for viewing
This file contains 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 charactersOriginal file line number Diff line number Diff line change @@ -58,8 +58,7 @@ ### Monitor number of connections in a TIME_WAIT state watch -d -n1 'ss -na state time-wait dport = :3306 or dport = :6379 or dport = :6380 or dport = :6381 | awk '\''{print $(NF)" "$(NF-1)}'\'' | sed '\''s/:[^ ]*$//g'\'' | sort | uniq -c | sort -n' watch -d -n1 'ss -na state established sport = :3306 or sport = :6379 or sport = :6380 or sport = :6381 | awk '\''{print $(NF-1)" "$(NF)}'\'' | sed '\''s/:[^ ]*$//g'\'' | sort | uniq -c | sort -nr' ### Add following bit to ~/.ssh/config on Fedora 29 when running in VMWare -
davidalger revised this gist
Apr 7, 2020 . 1 changed file with 18 additions and 17 deletions.There are no files selected for viewing
This file contains 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 charactersOriginal file line number Diff line number Diff line change @@ -1,73 +1,74 @@ ### list listening ports sudo lsof -nP -iTCP -sTCP:LISTEN sudo netstat -plunt ### flush DNS on Mojave sudo killall -HUP mDNSResponder ### immediately sleep displays pmset displaysleepnow ### monitor redis utilization redis-cli -p 6381 info | grep -E '(memory.*human|keyspace|total)' ### redis sentinel (find active master) redis-cli -h redis-node -p 26379 info sentinel | grep name=obj | head -n1 | tr , $'\n' | grep address | cut -d= -f2 | sed 's/:/ -p /' ### human readable memory info cat /proc/meminfo | grep Mem | awk '{print $1" "$2/1024/1024" GB"}' ### sort uniq nginx errors zgrep '2016/11/30' /var/log/nginx/*error.log* \ | perl -p -e 's/^(.*?):.*(\[[a-z]+\]) [0-9]+#[0-9]+:(?: \*[0-9]+)? (.*?,|.*?) (?:client: [0-9\.]+, )?(.*)$/$1 $2 $3 $4/' \ | perl -p -e 's/, (?:referrer|host|request): "[^"\n]+"//g' | perl -p -e 's/client_temp\/[0-9]+/client_temp\/<tmp_number>/' \ | sort | uniq -c | sort -n | less ### sort nginx log files by date cat access-log.txt | cut -d: -f2- | sort -t ' ' -k 4.9,4.12n -k 4.5,4.7M ### enumerate ssl ciphers nmap --script ssl-enum-ciphers -p 443 <hostname> ### http memory ps aux | grep 'http' | awk '{print $6/1024;}' | awk '{avg += ($1 - avg) / NR;} END {print avg " MB";}' ### show memory usage for php-fpm by user ps --no-headers -o size,pid,user,command --sort -size -C php-fpm -U www-prod | awk '{ hr=$1/1024 ; printf("%13.2f Mb %s ",hr,$2) } { for ( x=4 ; x<=NF ; x++ ) { printf("%s ",$x) } print "" }' ### show average memory usage for php-fpm by user ps --no-headers -o size,cmd -C php-fpm -U www-prod | awk '{ sum+=$1 } END { printf ("%d%s\n", sum/NR/1024,"M") }' ### show size of installed RAM dmidecode -t 17 | grep Size | awk '{s+=$2} END {print s/1024 " GB"}' ansible -i inventory-* all -b -m shell -a 'dmidecode -t 17 | grep Size | awk '\''{s+=$2} END {print s/1024 " GB"}'\''' ### Monitor number of connections in a TIME_WAIT state watch -d -n1 'ss -na state time-wait dport = :3306 or dport = :6379 or dport = :6380 or dport = :6381 | awk '\''{print $(NF)" "$(NF-1)}'\'' | sed '\''s/:[^ ]*$//g'\'' | sort | uniq -c | sort -n' watch -n0.25 'ss -na state established sport = :3306 or sport = :6379 or sport = :6380 or sport = :6381 | awk '\''{print $(NF-1)" "$(NF)}'\'' | sed '\''s/:[^ ]*$//g'\'' | sort | uniq -c | sort -nr' ### Add following bit to ~/.ssh/config on Fedora 29 when running in VMWare https://superuser.com/questions/1371506/from-vmware-and-fedora-29-ssh-to-remote-machine-cause-broken-pipe Host * IPQoS=throughput ### Cleanup nearly full /boot partition https://unix.stackexchange.com/a/105029/46493 -
davidalger revised this gist
Apr 6, 2020 . 1 changed file with 4 additions and 2 deletions.There are no files selected for viewing
This file contains 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 charactersOriginal file line number Diff line number Diff line change @@ -62,12 +62,14 @@ # Add following bit to ~/.ssh/config on Fedora 29 when running in VMWare https://superuser.com/questions/1371506/from-vmware-and-fedora-29-ssh-to-remote-machine-cause-broken-pipe Host * IPQoS=throughput # Cleanup nearly full /boot partition https://unix.stackexchange.com/a/105029/46493 yum install yum-utils package-cleanup --oldkernels --count=2 -
davidalger revised this gist
Apr 6, 2020 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains 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 charactersOriginal file line number Diff line number Diff line change @@ -62,7 +62,7 @@ # Add following bit to ~/.ssh/config on Fedora 29 when running in VMWare * https://superuser.com/questions/1371506/from-vmware-and-fedora-29-ssh-to-remote-machine-cause-broken-pipe Host * IPQoS=throughput -
davidalger revised this gist
Apr 6, 2020 . 2 changed files with 73 additions and 57 deletions.There are no files selected for viewing
This file contains 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 charactersOriginal file line number Diff line number Diff line change @@ -1,57 +0,0 @@ This file contains 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,73 @@ ## list listening ports sudo lsof -nP -iTCP -sTCP:LISTEN sudo netstat -plunt # flush DNS on Mojave sudo killall -HUP mDNSResponder # immediately sleep displays pmset displaysleepnow # monitor redis utilization redis-cli -p 6381 info | grep -E '(memory.*human|keyspace|total)' # redis sentinel (find active master) redis-cli -h redis-node -p 26379 info sentinel | grep name=obj | head -n1 | tr , $'\n' | grep address | cut -d= -f2 | sed 's/:/ -p /' # human readable memory info cat /proc/meminfo | grep Mem | awk '{print $1" "$2/1024/1024" GB"}' # sort uniq nginx errors zgrep '2016/11/30' /var/log/nginx/*error.log* \ | perl -p -e 's/^(.*?):.*(\[[a-z]+\]) [0-9]+#[0-9]+:(?: \*[0-9]+)? (.*?,|.*?) (?:client: [0-9\.]+, )?(.*)$/$1 $2 $3 $4/' \ | perl -p -e 's/, (?:referrer|host|request): "[^"\n]+"//g' | perl -p -e 's/client_temp\/[0-9]+/client_temp\/<tmp_number>/' \ | sort | uniq -c | sort -n | less # sort nginx log files by date cat access-log.txt | cut -d: -f2- | sort -t ' ' -k 4.9,4.12n -k 4.5,4.7M # enumerate ssl ciphers nmap --script ssl-enum-ciphers -p 443 <hostname> # http memory ps aux | grep 'http' | awk '{print $6/1024;}' | awk '{avg += ($1 - avg) / NR;} END {print avg " MB";}' # show memory usage for php-fpm by user ps --no-headers -o size,pid,user,command --sort -size -C php-fpm -U www-prod | awk '{ hr=$1/1024 ; printf("%13.2f Mb %s ",hr,$2) } { for ( x=4 ; x<=NF ; x++ ) { printf("%s ",$x) } print "" }' # show average memory usage for php-fpm by user ps --no-headers -o size,cmd -C php-fpm -U www-prod | awk '{ sum+=$1 } END { printf ("%d%s\n", sum/NR/1024,"M") }' # show size of installed RAM dmidecode -t 17 | grep Size | awk '{s+=$2} END {print s/1024 " GB"}' ansible -i inventory-* all -b -m shell -a 'dmidecode -t 17 | grep Size | awk '\''{s+=$2} END {print s/1024 " GB"}'\''' # Monitor number of connections in a TIME_WAIT state watch -d -n1 'ss -na state time-wait dport = :3306 or dport = :6379 or dport = :6380 or dport = :6381 | awk '\''{print $(NF)" "$(NF-1)}'\'' | sed '\''s/:[^ ]*$//g'\'' | sort | uniq -c | sort -n' # Add following bit to ~/.ssh/config on Fedora 29 when running in VMWare https://superuser.com/questions/1371506/from-vmware-and-fedora-29-ssh-to-remote-machine-cause-broken-pipe Host * IPQoS=throughput # Cleanup nearly full /boot partition; ref: https://unix.stackexchange.com/a/105029/46493 yum install yum-utils package-cleanup --oldkernels --count=2 -
davidalger revised this gist
Apr 6, 2020 . 1 changed file with 3 additions and 0 deletions.There are no files selected for viewing
This file contains 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 charactersOriginal file line number Diff line number Diff line change @@ -12,6 +12,9 @@ pmset displaysleepnow # monitor redis utilization redis-cli -p 6381 info | grep -E '(memory.*human|keyspace|total)' # redis sentinel (find active master) redis-cli -h redis-node -p 26379 info sentinel | grep name=obj | head -n1 | tr , $'\n' | grep address | cut -d= -f2 | sed 's/:/ -p /' # human readable memory info cat /proc/meminfo | grep Mem | awk '{print $1" "$2/1024/1024" GB"}' -
davidalger revised this gist
Mar 27, 2020 . 1 changed file with 2 additions and 2 deletions.There are no files selected for viewing
This file contains 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 charactersOriginal file line number Diff line number Diff line change @@ -1,6 +1,6 @@ # list listening ports sudo lsof -nP -iTCP -sTCP:LISTEN sudo netstat -plunt # flush DNS on Mojave -
davidalger revised this gist
Nov 15, 2019 . 1 changed file with 3 additions and 0 deletions.There are no files selected for viewing
This file contains 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 charactersOriginal file line number Diff line number Diff line change @@ -49,3 +49,6 @@ https://superuser.com/questions/1371506/from-vmware-and-fedora-29-ssh-to-remote- Host * IPQoS=throughput # Cleanup nearly full /boot partition; ref: https://unix.stackexchange.com/a/105029/46493 yum install yum-utils package-cleanup --oldkernels --count=2 -
davidalger revised this gist
Sep 12, 2019 . 1 changed file with 3 additions and 0 deletions.There are no files selected for viewing
This file contains 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 charactersOriginal file line number Diff line number Diff line change @@ -6,6 +6,9 @@ sudo netstat -plunt # flush DNS on Mojave sudo killall -HUP mDNSResponder # immediately sleep displays pmset displaysleepnow # monitor redis utilization redis-cli -p 6381 info | grep -E '(memory.*human|keyspace|total)' -
davidalger revised this gist
Jul 8, 2019 . 1 changed file with 3 additions and 0 deletions.There are no files selected for viewing
This file contains 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 charactersOriginal file line number Diff line number Diff line change @@ -3,6 +3,9 @@ sudo lsof -i -n -P | grep LISTEN sudo netstat -plunt # flush DNS on Mojave sudo killall -HUP mDNSResponder # monitor redis utilization redis-cli -p 6381 info | grep -E '(memory.*human|keyspace|total)' -
davidalger revised this gist
Jun 4, 2019 . 1 changed file with 7 additions and 0 deletions.There are no files selected for viewing
This file contains 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 charactersOriginal file line number Diff line number Diff line change @@ -36,3 +36,10 @@ ansible -i inventory-* all -b -m shell -a 'dmidecode -t 17 | grep Size | awk '\' # Monitor number of connections in a TIME_WAIT state watch -d -n1 'ss -na state time-wait dport = :3306 or dport = :6379 or dport = :6380 or dport = :6381 | awk '\''{print $(NF)" "$(NF-1)}'\'' | sed '\''s/:[^ ]*$//g'\'' | sort | uniq -c | sort -n' # Add following bit to ~/.ssh/config on Fedora 29 when running in VMWare https://superuser.com/questions/1371506/from-vmware-and-fedora-29-ssh-to-remote-machine-cause-broken-pipe Host * IPQoS=throughput -
davidalger revised this gist
Dec 1, 2018 . 1 changed file with 3 additions and 0 deletions.There are no files selected for viewing
This file contains 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 charactersOriginal file line number Diff line number Diff line change @@ -21,6 +21,9 @@ cat access-log.txt | cut -d: -f2- | sort -t ' ' -k 4.9,4.12n -k 4.5,4.7M # enumerate ssl ciphers nmap --script ssl-enum-ciphers -p 443 <hostname> # http memory ps aux | grep 'http' | awk '{print $6/1024;}' | awk '{avg += ($1 - avg) / NR;} END {print avg " MB";}' # show memory usage for php-fpm by user ps --no-headers -o size,pid,user,command --sort -size -C php-fpm -U www-prod | awk '{ hr=$1/1024 ; printf("%13.2f Mb %s ",hr,$2) } { for ( x=4 ; x<=NF ; x++ ) { printf("%s ",$x) } print "" }' -
davidalger revised this gist
Nov 17, 2018 . 1 changed file with 4 additions and 0 deletions.There are no files selected for viewing
This file contains 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 charactersOriginal file line number Diff line number Diff line change @@ -1,4 +1,8 @@ # list listening ports (on macOS followed by command for Linux) sudo lsof -i -n -P | grep LISTEN sudo netstat -plunt # monitor redis utilization redis-cli -p 6381 info | grep -E '(memory.*human|keyspace|total)' -
David Alger revised this gist
Aug 20, 2018 . 1 changed file with 3 additions and 0 deletions.There are no files selected for viewing
This file contains 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 charactersOriginal file line number Diff line number Diff line change @@ -26,3 +26,6 @@ ps --no-headers -o size,cmd -C php-fpm -U www-prod | awk '{ sum+=$1 } END { prin # show size of installed RAM dmidecode -t 17 | grep Size | awk '{s+=$2} END {print s/1024 " GB"}' ansible -i inventory-* all -b -m shell -a 'dmidecode -t 17 | grep Size | awk '\''{s+=$2} END {print s/1024 " GB"}'\''' # Monitor number of connections in a TIME_WAIT state watch -d -n1 'ss -na state time-wait dport = :3306 or dport = :6379 or dport = :6380 or dport = :6381 | awk '\''{print $(NF)" "$(NF-1)}'\'' | sed '\''s/:[^ ]*$//g'\'' | sort | uniq -c | sort -n' -
David Alger revised this gist
Jul 13, 2018 . 1 changed file with 4 additions and 0 deletions.There are no files selected for viewing
This file contains 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 charactersOriginal file line number Diff line number Diff line change @@ -22,3 +22,7 @@ ps --no-headers -o size,pid,user,command --sort -size -C php-fpm -U www-prod | a # show average memory usage for php-fpm by user ps --no-headers -o size,cmd -C php-fpm -U www-prod | awk '{ sum+=$1 } END { printf ("%d%s\n", sum/NR/1024,"M") }' # show size of installed RAM dmidecode -t 17 | grep Size | awk '{s+=$2} END {print s/1024 " GB"}' ansible -i inventory-* all -b -m shell -a 'dmidecode -t 17 | grep Size | awk '\''{s+=$2} END {print s/1024 " GB"}'\''' -
David Alger revised this gist
May 4, 2017 . 1 changed file with 5 additions and 2 deletions.There are no files selected for viewing
This file contains 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 charactersOriginal file line number Diff line number Diff line change @@ -17,5 +17,8 @@ cat access-log.txt | cut -d: -f2- | sort -t ' ' -k 4.9,4.12n -k 4.5,4.7M # enumerate ssl ciphers nmap --script ssl-enum-ciphers -p 443 <hostname> # show memory usage for php-fpm by user ps --no-headers -o size,pid,user,command --sort -size -C php-fpm -U www-prod | awk '{ hr=$1/1024 ; printf("%13.2f Mb %s ",hr,$2) } { for ( x=4 ; x<=NF ; x++ ) { printf("%s ",$x) } print "" }' # show average memory usage for php-fpm by user ps --no-headers -o size,cmd -C php-fpm -U www-prod | awk '{ sum+=$1 } END { printf ("%d%s\n", sum/NR/1024,"M") }' -
David Alger revised this gist
May 3, 2017 . 1 changed file with 3 additions and 0 deletions.There are no files selected for viewing
This file contains 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 charactersOriginal file line number Diff line number Diff line change @@ -16,3 +16,6 @@ cat access-log.txt | cut -d: -f2- | sort -t ' ' -k 4.9,4.12n -k 4.5,4.7M # enumerate ssl ciphers nmap --script ssl-enum-ciphers -p 443 <hostname> # show memory usage by process (source: http://php.ingewikkeld.net/entry/human-readable-memory-usage-in-linux-per-process) ps -eo size,pid,user,command --sort -size | awk '{ hr=$1/1024 ; printf("%13.2f Mb %s ",hr,$2) } { for ( x=4 ; x<=NF ; x++ ) { printf("%s ",$x) } print "" }' -
David Alger revised this gist
May 1, 2017 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains 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 charactersOriginal file line number Diff line number Diff line change @@ -3,7 +3,7 @@ redis-cli -p 6381 info | grep -E '(memory.*human|keyspace|total)' # human readable memory info cat /proc/meminfo | grep Mem | awk '{print $1" "$2/1024/1024" GB"}' # sort uniq nginx errors zgrep '2016/11/30' /var/log/nginx/*error.log* \ -
David Alger revised this gist
Apr 28, 2017 . 1 changed file with 3 additions and 0 deletions.There are no files selected for viewing
This file contains 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 charactersOriginal file line number Diff line number Diff line change @@ -13,3 +13,6 @@ zgrep '2016/11/30' /var/log/nginx/*error.log* \ # sort nginx log files by date cat access-log.txt | cut -d: -f2- | sort -t ' ' -k 4.9,4.12n -k 4.5,4.7M # enumerate ssl ciphers nmap --script ssl-enum-ciphers -p 443 <hostname> -
David Alger revised this gist
Jan 24, 2017 . No changes.There are no files selected for viewing
-
David Alger revised this gist
Jan 24, 2017 . 1 changed file with 3 additions and 0 deletions.There are no files selected for viewing
This file contains 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 charactersOriginal file line number Diff line number Diff line change @@ -10,3 +10,6 @@ zgrep '2016/11/30' /var/log/nginx/*error.log* \ | perl -p -e 's/^(.*?):.*(\[[a-z]+\]) [0-9]+#[0-9]+:(?: \*[0-9]+)? (.*?,|.*?) (?:client: [0-9\.]+, )?(.*)$/$1 $2 $3 $4/' \ | perl -p -e 's/, (?:referrer|host|request): "[^"\n]+"//g' | perl -p -e 's/client_temp\/[0-9]+/client_temp\/<tmp_number>/' \ | sort | uniq -c | sort -n | less # sort nginx log files by date cat access-log.txt | cut -d: -f2- | sort -t ' ' -k 4.9,4.12n -k 4.5,4.7M -
David Alger revised this gist
Nov 30, 2016 . 1 changed file with 6 additions and 0 deletions.There are no files selected for viewing
This file contains 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 charactersOriginal file line number Diff line number Diff line change @@ -4,3 +4,9 @@ redis-cli -p 6381 info | grep -E '(memory.*human|keyspace|total)' # human readable memory info cat /proc/meminfo | grep MemTotal | awk '{print $2/1024/1024 " GB"}' # sort uniq nginx errors zgrep '2016/11/30' /var/log/nginx/*error.log* \ | perl -p -e 's/^(.*?):.*(\[[a-z]+\]) [0-9]+#[0-9]+:(?: \*[0-9]+)? (.*?,|.*?) (?:client: [0-9\.]+, )?(.*)$/$1 $2 $3 $4/' \ | perl -p -e 's/, (?:referrer|host|request): "[^"\n]+"//g' | perl -p -e 's/client_temp\/[0-9]+/client_temp\/<tmp_number>/' \ | sort | uniq -c | sort -n | less -
David Alger created this gist
Nov 29, 2016 .There are no files selected for viewing
This file contains 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,6 @@ # monitor redis utilization redis-cli -p 6381 info | grep -E '(memory.*human|keyspace|total)' # human readable memory info cat /proc/meminfo | grep MemTotal | awk '{print $2/1024/1024 " GB"}'