Hi All
I need help to get the capacity info in below format :
Data Center | Cluster Name | Total Servers | Server Type | Sockets Per Server | All servers have Hyperthreading Enabled ? | Cores Per Socker Per Server | Total Phy Cores | CPU | RAM GB | RAM in cluster | Total Powered On VMs | Cores allocated | CPU Ratio | Allocated RAM | RAM Ratio | CPU usage % Approx | RAM Usage % Approx | CPU GHz Capacity | CPU GHz Used |
Also i need to ensure we consider only Powered on VMs in each cluster.
Thanks
What do you already have?
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Hi LucD
I have a script from Jonathan Medd , i did small change for power on vms
==
function Get-ClusterCapacityCheck {
<#
.SYNOPSIS
Retrieves basic capacity info for VMware clusters
.DESCRIPTION
Retrieves basic capacity info for VMware clusters
.PARAMETER ClusterName
Name of the computer to test the services for
.EXAMPLE
PS C:\> Get-ClusterCapacityCheck -ClusterName Cluster01
.EXAMPLE
PS C:\> Get-Cluster | Get-ClusterCapacityCheck
.NOTES
Author: Jonathan Medd
Date: 18/01/2012
#>
[CmdletBinding()]
param(
[Parameter(Position=0,Mandatory=$true,HelpMessage="Name of the cluster to test",
ValueFromPipeline=$True,ValueFromPipelineByPropertyName=$true)]
[System.String]
$ClusterName
)
begin {
$Finish = (Get-Date -Hour 0 -Minute 0 -Second 0)
$Start = $Finish.AddDays(-1).AddSeconds(1)
New-VIProperty -Name FreeSpaceGB -ObjectType Datastore -Value {
param($ds)
[Math]::Round($ds.FreeSpaceMb/1KB,0)
} -Force
}
process {
$Cluster = Get-Cluster $ClusterName
$ClusterCPUCores = $Cluster.ExtensionData.Summary.NumCpuCores
$ClusterEffectiveMemoryGB = [math]::round(($Cluster.ExtensionData.Summary.EffectiveMemory / 1KB),0)
$ClusterVMs = $Cluster | Get-VM | Where-Object -Property PowerState -eq 'PoweredOn'
$ClusterAllocatedvCPUs = ($ClusterVMs | Measure-Object -Property NumCPu -Sum).Sum
$ClusterAllocatedMemoryGB = [math]::round(($ClusterVMs | Measure-Object -Property MemoryMB -Sum).Sum / 1KB)
$ClustervCPUpCPURatio = [math]::round($ClusterAllocatedvCPUs / $ClusterCPUCores,2)
$ClusterActiveMemoryPercentage = [math]::round(($Cluster | Get-Stat -Stat mem.usage.average -Start $Start -Finish $Finish | Measure-Object -Property Value -Average).Average,0)
$VMHost = $Cluster | Get-VMHost | Select-Object -Last 1
$ClusterFreeDiskspaceGB = ($VMHost | Get-Datastore | Where-Object {$_.Extensiondata.Summary.MultipleHostAccess -eq $True} | Measure-Object -Property FreeSpaceGB -Sum).Sum
New-Object -TypeName PSObject -Property @{
Cluster = $Cluster.Name
ClusterCPUCores = $ClusterCPUCores
ClusterAllocatedvCPUs = $ClusterAllocatedvCPUs
ClustervCPUpCPURatio = $ClustervCPUpCPURatio
ClusterEffectiveMemoryGB = $ClusterEffectiveMemoryGB
ClusterAllocatedMemoryGB = $ClusterAllocatedMemoryGB
ClusterActiveMemoryPercentage = $ClusterActiveMemoryPercentage
ClusterFreeDiskspaceGB = $ClusterFreeDiskspaceGB
}
}
}
#
So what are you missing?
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
script gives ( sample output )
ClusterEffectiveMemoryGB : 1116
Cluster : xx
ClusterAllocatedvCPUs : 172
ClusterCPUCores : 60
ClusterFreeDiskspaceGB : 3268
ClustervCPUpCPURatio : 2.87
ClusterAllocatedMemoryGB : 680
ClusterActiveMemoryPercentage : 56
===
below info is missing
Data Center
Total Phy Servers in cluster
Server Type ( Hardware Model )
Sockets Per Server
All servers have Hyper-threading Enabled ?
Cores Per Socket Per Server
Total Powered On VMs
RAM Ratio
CPU GHz Capacity
CPU GHz Used
CPU Model