Skip to content

Instantly share code, notes, and snippets.

@guyromm
Created November 3, 2015 09:16
Show Gist options
  • Select an option

  • Save guyromm/6852f57f565fd1dd723d to your computer and use it in GitHub Desktop.

Select an option

Save guyromm/6852f57f565fd1dd723d to your computer and use it in GitHub Desktop.
retrieve block device stats for all libvirt machines on a node
#!/bin/bash
IS=$(virsh list | grep -v Name | awk '{print $2}')
for I in $IS ; do
BLKS="$(virsh domblklist $I| egrep -v '^(Target|\-\-\-)' | awk '{print $1}')"
for BLK in $BLKS ; do
virsh domblkstat $I $BLK | egrep -v '^$' | sed -e 's/^/'$I' /'
done
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment