Show OpenVZ containers' disk use in GB and as percentage of the host's total disk space. Tested with Proxmox VE.
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
#!/bin/bash | |
# jnm 20140311 | |
TOTAL_AVAILABLE=$(df /var/lib/vz | grep '/var/lib/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