Created
January 10, 2010 17:11
-
-
Save koduki/273618 to your computer and use it in GitHub Desktop.
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 | |
# | |
# use | |
# watch ./top.sh | |
# | |
OUT="/tmp/topdata" | |
echo "---- cpu ----" >> $OUT | |
mpstat -P ALL|awk 'NR > 3 {print "CPU("$2"): \t"$3"% usr,\t"$4"% nice,\t"$5"% sys,\t"$6"% iowait"}' > $OUT | |
echo "---- memory ----" >> $OUT | |
free -m|awk '{print $1"\t"$2"MB total,\t"$3"MB used, \t"$4"MB free" }'|grep -e "Mem" -e "Swap" >> $OUT | |
echo "---- disk I/O ----" >> $OUT | |
iostat -k|awk 'NR > 5 && $1 != "" {print $_}' >> $OUT | |
echo "---- network ----" >> $OUT | |
netstat -i |awk 'NR > 1 {print $_}' >> $OUT | |
echo "---- process ----" >> $OUT | |
echo "USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND" >> $OUT | |
ps aux|sort -n -k 3 -r|head -5 >> $OUT | |
cat $OUT |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment