Irregular Expressions

Feb 1 2010   5:08PM GMT

Using vdf to report on storage usage

Dan O'Connor Dan O'Connor Profile: Dan O'Connor

VMWare has some excellent command-line tools.

vdf will produce a list of mounts on the system and the associated storage used for each mount point, exactly like df but this will include the vmfs volumes.

You can produce a nice output of this information using awk and grep.

vdf -h | grep -E ‘^\ +[0-9]’ | awk ‘{ print $4″ “$5 }’ | sort -rn | awk ‘{ print $2” “$1 }’

The lines that you are interested in start with multiple spaces then numbers so “grep -E ‘^\ +[0-9]’ ”

The first awk is used to pull out the name of the storage unit and the associated usage %. “awk  ‘{ print $4” “$5 }'”

Sort is then used to sort it with the highest usage on top. “sort -rn”

Then the last awk is used to print out name then usage, this is just a personal preference. “awk ‘{ print $2” “$1 }’ ”

Now with this nice formatted data you can pull this in to your central logging device and create some charts and alerts.

/vmfs/volumes/NAME 44%

 Comment on this Post

There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when other members comment.

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

Share this item with your network: