VMware Cloud Community
KrisVdV
Contributor
Contributor

finding DRS cluster with most storage

Hi,

I think this is an obvious question, but I can't seem to find the solution.

We have a number of DRS clusters and the ESX hosts inside these clusters have been assigned a number of datastores (LUNs from our SAN environment).

-> When I need to deploy a number of new VMs, how can I easily check which DRS cluster has the most free storage to put the new VMs on?

Is there also an easy way to check which cluster has the most available CPU and RAM resources without manually checking every cluster one by one?

Thanks,

Kris

0 Kudos
5 Replies
FranckRookie
Leadership
Leadership

Hi Kris,

You need a synthetic view of your storage to decide where to place your VM. Maybe a tool like RVTools can help you.

It's more complicated for CPU and memory because you will catch an instant view of the activity of your clusters. But you don't know how they perform all day long. So to balance your clusters, you have to follow there usage with performance graphs for representative period of time to take your decision.

Hope it helps

Regards

Franck

RvdNieuwendijk
Leadership
Leadership

You can use VMware vSphere PowerCLI to answer both questions. The next PowerCLI script displays the total free size on all datastores for all your clusters in megabytes. Replace with the name of your vCenter server.

Connect-VIServer <YourvCenterServerName>
Get-Cluster | ForEach-Object {
  $Cluster= $_
  $cluster | Get-VMHost | Get-Datastore | `
  ForEach-Object -Begin {$FreeSpaceMB = 0} -Process {$FreeSpaceMB += $_.FreeSpaceMB} -End {$FreeSpaceMB}} | `
  Select-Object -Property @{N="Cluster";E={$Cluster.Name}},@{N="FreeSpaceMB";E={$_}}

For the question about the cluster that has the most available free CPU and RAM you can use Alan Renouf's vCheck script. The "Capacity Planner Info" section of the report the script generates gives an estimate about how much more VM's your clusters can host depending on CPU and memory.

Regards, Robert

Blog: https://rvdnieuwendijk.com/ | Twitter: @rvdnieuwendijk | Author of: https://www.packtpub.com/virtualization-and-cloud/learning-powercli-second-edition
KrisVdV
Contributor
Contributor

Thanks Franck, I'l give it a try!

0 Kudos
KrisVdV
Contributor
Contributor

Hi Robert,

Thanks for the script. I tried it and for some of our clusters, it works, but for others, I receive:

Get-Datastore : Object reference not set to an instance of an object.

At D:\Admin\Scripts\vi\krva_test\check_free_space.ps1:7 char:40

+ $cluster | Get-VMHost | Get-Datastore &lt;&lt;&lt;&lt; | `

I'm not familiar with CLI scripting, do you have any idea what could cause this?

Thanks,

Kris

0 Kudos
RvdNieuwendijk
Leadership
Leadership

Hi Kris,

it looks like the error is caused by a cluster without hosts. Do you have that situation?

Regards, Robert

Blog: https://rvdnieuwendijk.com/ | Twitter: @rvdnieuwendijk | Author of: https://www.packtpub.com/virtualization-and-cloud/learning-powercli-second-edition
0 Kudos