| #!/bin/bash |
| |
| |
| |
| |
| t_Log "Running $0 - a basic iostat test to verify disk measurement" |
| |
| |
| TMP=/tmp/iostat.disk.scratch |
| |
| |
| BS=4196 |
| COUNT=10100 |
| SUM=$(expr $BS \* $COUNT / 1024) |
| |
| |
| trap "[ -e $TMP ] && { /bin/rm -f $TMP; }" EXIT |
| |
| |
| echo 1 > /proc/sys/vm/drop_caches |
| |
| |
| DRIVE=$(fdisk -l|grep -Po -m1 '^/dev/[\D]+') |
| |
| |
| /usr/bin/iostat -dkx 1 5 $DRIVE >$TMP & |
| |
| |
| sleep 4 |
| |
| |
| /bin/dd if=$DRIVE of=/dev/null bs=$BS count=$COUNT &>/dev/null |
| |
| |
| sleep 6 |
| |
| |
| |
| BYTES_READ=$(awk '$6 ~ /[0-9]/ {NR>1 && sum+=$6} END {print int(sum)}' $TMP) |
| |
| |
| [ "$BYTES_READ" -ge "$SUM" ] || { t_Log "iostat didn't log as much traffic as we generated?!...that ain't good"; } |
| |
| t_CheckExitStatus $? |