Created
September 26, 2016 21:01
-
-
Save fipar/beef5484740d658f563d70a11b912f71 to your computer and use it in GitHub Desktop.
Collect basic cpu/mem/network/io info from host for 30 secs
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
test -x pt-diskstats || { | |
wget http://www.percona.com/get/pt-diskstats | |
chmod +x pt-diskstats | |
} | |
reqs="" | |
which netstat || reqs="netstat $reqs" | |
which vmstat || reqs="vmstat $reqs" | |
which top || reqs="top $reqs" | |
rpm -qa > /tmp/rpms.$$ | |
grep perl-Time-HiRes /tmp/rpms.$$ || reqs="perl-Time-HiRes $reqs" | |
grep perl-Digest-MD5 /tmp/rpms.$$ || reqs="perl-Digest-MD5 $reqs" | |
rm -f /tmp/rpms.$$ | |
[ -n "$reqs" ] && { | |
echo "missing: $reqs" | |
} || { | |
( ./pt-diskstats </dev/null --iterations 30 --show-inactive &> diskstats.log ) & | |
( vmstat 1 30 > vmstat.log ) & | |
( netstat -np 1 > netstat.log ) & | |
netstat_pid=$! | |
( top -b -n 30 > top.log ) & | |
sleep 30 | |
kill $netstat_pid | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment