Solved

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

Posted on 2015-02-10
5
205 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
5 Comments
 
LVL 5

Accepted Solution

by:
GG VP earned 500 total points
ID: 40600603
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
ID: 40601542
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
ID: 40601590
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
ID: 40601632
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
ID: 40602503
Glad to see your issue resolved and thanks for posting back, this will help others looking for a similar solution!
0

Featured Post

Monthly Recap

May was a big month for new releases from Linux Academy! Take a look at what our team built recently in our blog. You can access the newest releases from our blog.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The following article is comprised of the pearls we have garnered deploying virtualization solutions since Virtual Server 2005 and subsequent 2008 RTM+ Hyper-V in standalone and clustered environments.
In this article, I show you step by step with screenshots to assist you - HOW TO: Deploy and Install the VMware vCenter Server Appliance 6.5 (VCSA 6.5), with some helpful tips along the way.
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
This video shows you how to use a vSphere client to connect to your ESX host as the root user. Demonstrates the basic connection of bypassing certification set up. Demonstrates how to access the traditional view to begin managing your virtual mac…

707 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