Last active
December 3, 2019 17:41
-
-
Save niedbalski/9a8648490f7633d48f20776014b2ced8 to your computer and use it in GitHub Desktop.
sockstats-report.sh
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 characters
#!/bin/bash | |
# gather metrics about sockstat and buffer size. | |
currdate=$(date +"%m-%d-%Y") | |
timeout=${1:-600} | |
every=${2:-1} | |
basepath=${3:-./sockstat-report-${currdate}/} | |
function watch_it() { | |
timeout $1 watch -t -n $2 "cat $3 | tee -a ${basepath}$(basename ${3})_${currdate}.log" &>/dev/null & | |
} | |
function main() { | |
test -d $basepath || mkdir ${basepath} | |
for f in $(ls /proc/sys/net/ipv4/tcp*mem /proc/net/sockstat); do | |
watch_it $1 $2 $f | |
done | |
timeout $1 watch -t -n $2 "ss -m --info -t4 | tee -a ${basepath}ss_${currdate}.log" &>/dev/null & | |
timeout $1 sar -n EDEV -n SOCK 1 | tee -a ${basepath}sar_edev_${currdate}.log &>/dev/null & | |
} | |
main ${timeout} ${every} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment