-
-
Save azilber/66508ebe9fb24791161897aadbd83731 to your computer and use it in GitHub Desktop.
Show OpenVZ containers' disk use in GB and as percentage of the host's total disk space. Tested with Proxmox VE.
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 | |
# jnm 20140311 | |
TOTAL_AVAILABLE=$(df /vz | grep '/vz$' | awk '{ print $2 }') | |
vzlist -o ctid,numproc,status,ip,hostname,diskspace -s diskspace | awk ' | |
{ | |
printf $0 "\t" | |
if(NR==1) | |
{ | |
print "in G\tas % of host" | |
} | |
else | |
{ | |
printf "%2.f\t%0.f\n", $NF / 1024 / 1024, $NF * 100 / $TOTAL_AVAILABLE | |
} | |
}' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment