Created
April 2, 2013 18:44
-
-
Save Aricg/5294986 to your computer and use it in GitHub Desktop.
parses iostat to show sectors written per second vs the queue of reads/writes pending. Specific to my purposes. Go away ;)
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 | |
| sda=sda | |
| numlines=60 | |
| outputr=$1 | |
| outputw=$2 | |
| getread() { | |
| a=() | |
| while read -d $'\n'; do | |
| a+=("$REPLY") | |
| done < <(echo "$@" | sed 's,\,,,g' | awk '{print "r_sectors " $6 " queue" $8"0"}' ) | |
| } | |
| getwrite() { | |
| b=() | |
| while read -d $'\n'; do | |
| b+=("$REPLY") | |
| done < <(echo "$@" | sed 's,\,,,g'| awk '{print "w_sectors " $7 " queue " $8"0"}' ) | |
| } | |
| zz=0 | |
| while (( zz < $numlines )); | |
| do | |
| x="$(iostat -x 1 2| grep -v sdb | tail -n 2)" | |
| getread "$x" | |
| echo -n ""READS " "${a[@]}"" >>$outputr ; echo " load: " $(uptime | awk '{print $10}'| sed 's,\,,,g' | sed 's,\.,,g') >>$outputr | |
| getwrite "$x" | |
| echo -n ""WRITES" "${b[@]}"" >>$outputw ; echo " load: " $(uptime | awk '{print $10}'| sed 's,\,,,g' | sed 's,\.,,g') >>$outputw | |
| (( zz++ )) | |
| done | |
| #send this to datafart for a nice graph |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment