Last active
April 18, 2018 01:56
-
-
Save joeljacobs/73d2b4799bffc63f5156d68a454d9dc2 to your computer and use it in GitHub Desktop.
virsh mem
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
function vmmem { free="$(free -h)";echo "$free";memtotal=0 ; for i in $(virsh list --name); do mem=$(( $(virsh dommemstat $i |head -1|cut -d " " -f 2) /1024/1024));memtotal=$(( $memtotal + $mem)); printf "%-20s%10s\n" $i $mem; done; echo " Total VM ${memtotal}G"; echo " Difference: $(( $(echo "$free" |grep "Mem:"|cut -d " " -f 12|rev|cut -c 2-|rev) - $memtotal))G"|sort -V; } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment