Solved

Script or tool to gather Datastore Space info from multiple DC's and clusters?

Posted on 2015-02-10
5
197 Views
Last Modified: 2015-02-10
Hello,
I need to figure out a way to script or use a tool to gather info and export to a spread sheet.

What I need is a way to look at the status of datastores, total size, used space, and free space. Over several datacenters in vsphere and several clusters per DC. The most important info I need is the cluster name, datastore name, and free space.

I recently started using RVTools and is seem great but I don't see a way to get the info I need so far. Preferably I would love to be able to run a script or tool one time to gather info on all the vsphere DC's.

Can someone help point me in the right direction?
0
Comment
Question by:REIUSA
  • 3
  • 2
5 Comments
 
LVL 5

Accepted Solution

by:
GG VP earned 500 total points
Comment Utility
You can use Vsphere Client, if that doesn't provide what you are looking for, then PowerCLI can be used to get the info,

Here is the one liner from the blog post,

http://www.vnoob.com/2013/07/quicktip-get-datastore-capacity-with-a-powercli-one-liner/

get-datastore | select-object name,@{Label=”FreespaceGB”;E={“{0:n2}” -f ($_.FreespaceGB)}}, CapacityGB, @{Label=”Provisioned”;E={“{0:n2}” -f ($_.CapacityGB – $_.FreespaceGB +($_.extensiondata.summary.uncommitted/1GB))}}|sort name

Open in new window


Please have a look at the following scripts too,

http://vsential.com/2010/09/datastore-size-reporting-via-powercli-script/

http://www.vmwarearena.com/2013/12/powershell-script-to-collect-datastore.html
0
 

Author Comment

by:REIUSA
Comment Utility
Thanks, it looks like the second two links are working and I can generate a report. When I run the code at vsential that pretty much does what I need it to do but I need to add free space in addition to free %.

Any idea what the syntax would be to add actual free space to the CSV output?
0
 

Author Comment

by:REIUSA
Comment Utility
I think I see where to make the change but I'm not sure what to put in place of ".ExtensionData.Summary.FreeSpace" to show the actual Free space. In this script the below syntax is what shows the UsedSpace.

@{N=”UsedSpaceGB”;E={[Math]::Round(($_.ExtensionData.Summary.Capacity – $_.ExtensionData.Summary.FreeSpace)/1GB,0)}}
0
 

Author Comment

by:REIUSA
Comment Utility
Got it working now with the following syntax. I don't know if the Math in brackets is needed but I left it in and it worked. I didn't realize at first the other sections were subtracting one number from another.

@{N=”FreeSpaceGB”;E={[Math]::Round(($_.ExtensionData.Summary.FreeSpace)/1GB,0)}}

Thanks for your help.
0
 
LVL 5

Expert Comment

by:GG VP
Comment Utility
Glad to see your issue resolved and thanks for posting back, this will help others looking for a similar solution!
0

Featured Post

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

It Is not possible to enable LLDP in vSwitch(at least is not supported by VMware), so in this article we will enable this, and also go trough how to enabled CDP and how to get this information in vSwitches and also in vDS.
Exchange server is not supported in any cloud-hosted platform (other than Azure with Azure Premium Storage).
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
In this fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF's Info Dictionary, as well as some other information, including the page count. We show how to isolate the page count in a…

744 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now