Skip to content

Instantly share code, notes, and snippets.

@Aricg
Created March 29, 2013 20:40
Show Gist options
  • Save Aricg/5273503 to your computer and use it in GitHub Desktop.
Save Aricg/5273503 to your computer and use it in GitHub Desktop.
Making I/O graphs for a customer
#!/bin/bash
#This Script parses the output of these two files
#iostat -N vg_backup-lv_backup 1 > iostat_output &
#cat iostat_output | grep vg_backup-lv_backup >vg_only
#where vg_backup-lv_backup is the name of your lv (see the names of you lvs here ls -l /dev/mapper/)
numlines=5000
geta() {
a=()
while read -d $'\n'; do
a+=("$REPLY")
done < <(cat iostat_output | grep -A2 iowait | awk '{ print $4 }' | sed 's,\,,,g' | grep -o '[0-9]*' | sed 's/.$//')
}
getb() {
b=()
while read -d $'\n'; do
b+=("$REPLY")
done < <(head -n $numlines vg_only | awk '{ print $3 }' |sed 's/...$//')
}
getc() {
c=()
while read -d $'\n'; do
c+=("$REPLY")
done < <(head -n $numlines vg_only | awk '{ print $4 }' |sed 's/...$//')
}
geta
getb
getc
while (( zz < $numlines ))
do
echo "reads "${b[$zz]}" iowait "${a[$zz]}" writes "${c[$zz]}""
(( zz++ ))
done
#Optional send the output to datafart (max 999 lines)
#alias datafart='curl --data-binary @- datafart.com'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment