Created
December 3, 2019 17:26
-
-
Save niedbalski/4b4273bf5ab4f56eac5ac450ea167b7b to your computer and use it in GitHub Desktop.
check-sockstats.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. | |
# | |
timeout=${1:-600} | |
every=${2:-1} | |
function watch_it() { | |
timeout $1 watch -t -n $2 "cat $3 | tee -a $(basename ${3})_$(date +"%m-%d-%Y").log" &>/dev/null & | |
} | |
function main() { | |
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 ss_$(date +"%m-%d-%Y").log" &>/dev/null & | |
timeout $1 sar -n EDEV -n SOCK 1 > sar_edev_$(date +"%m-%d-%Y").log &>/dev/null & | |
} | |
main ${timeout} ${every} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment