Created
January 13, 2014 09:43
-
-
Save evaisse/8397244 to your computer and use it in GitHub Desktop.
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/sh | |
# vmstat_tool.sh | |
# vmstat parser script. Makes the information easily readable. | |
# Ensure that the number of loops and delay parameters | |
# were passed to this script | |
# examine output with : nohup vmstat_tool.sh 100 > ./vmstat.log & | |
if [ $# -ne 1 ] | |
then | |
echo "Usage: $0 count" | |
exit | |
fi | |
export LPCNT=$1 | |
export DLAY=1 | |
c=0 | |
while [ "$c" -lt $LPCNT ] | |
do | |
date | |
vmstat | tail -n 1 | awk '{printf("%d processes are waiting\n%d processes are blocked\n%d virtual memory used, %d idle memory, %d buffer memory, %d cache memory\n%d memory swapped in from disk, %d memory swapped out to disk\n%d blocks per second written\n%d blocks per second read\n%d interrupts per second\n%d context switches per second\nCPU usage: %d%% (user, non-kernel), %d%% (system, kernel), %d%% idle, %d%% wait\n\n",$1,$2,$3,$4,$5,$6,$7,$8,$9,$10,$11,$12,$13,$14,$15,$16)}' | |
sleep $DLAY | |
c=$((c+1)) | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment