I'm building a script that gets information about the HA level, but it seems that the new percentage setting is messing up the Get-Cluster output.
PowerCLI E:\> Get-Cluster | fl
HATotalSlots :
HAUsedSlots :
HAAvailableSlots :
HASlotCpuMHz :
HASlotMemoryMb :
HASlotNumVCpus :
ParentId : Folder-group-h4
ParentFolder : host
HAEnabled : True
HAAdmissionControlEnabled : True
HAFailoverLevel : 0
HARestartPriority : Medium
HAIsolationResponse : PowerOff
VMSwapfilePolicy : WithVM
DrsEnabled : True
DrsMode : FullyAutomated
DrsAutomationLevel : FullyAutomated
Name : cluster01.vmware.local
CustomFields : {[VEEAM_Business_Unit, ], [VEEAM_Department, ], [VE
EAM_Purpose, ]}
ExtensionData : VMware.Vim.ClusterComputeResource
Id : ClusterComputeResource-domain-c7
Uid : /VIServer=@vcenter1.vmware.local:443/Cluster=Cluste
rComputeResource-domain-c7/
Is there any way to get the slot size and the percentage levels by using Get-Cluster, or do I need to find another way to do this?
Are these properties also missing when you do
Get-Cluster | Select *
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
I don't know an easy way to get the cluster HA slot size. But you can get the HA percentages with:
Get-Cluster | Select-Object -Property Name, @{N="CpuFailoverResourcesPercentage";E={$_.ExtensionData.Configuration.DasConfig.AdmissionControlPolicy.CpuFailoverResourcesPercent}}, @{N="MemoryFailoverResourcesPercentage";E={$_.ExtensionData.Configuration.DasConfig.AdmissionControlPolicy.MemoryFailoverResourcesPercent}}
Regards, Robert
I actually thinkg I figured it out.
PowerCLI E:\> $tmp = Get-Cluster
PowerCLI E:\> $tmp.ExtensionData.Configuration.DasConfig.AdmissionControlPolicy
CpuFailoverResource MemoryFailoverResou DynamicType DynamicProperty
sPercent rcesPercent
------------------- ------------------- ----------- ---------------
30 30
It doesn't give me the slot info I want to see, but I can extract the memory settings..
LucD;
PowerCLI E:\> Get-Cluster | Select *
HATotalSlots :
HAUsedSlots :
HAAvailableSlots :
HASlotCpuMHz :
HASlotMemoryMb :
HASlotNumVCpus :
ParentId : Folder-group-h4
ParentFolder : host
HAEnabled : True
HAAdmissionControlEnabled : True
HAFailoverLevel : 0
HARestartPriority : Medium
HAIsolationResponse : PowerOff
VMSwapfilePolicy : WithVM
DrsEnabled : True
DrsMode : FullyAutomated
DrsAutomationLevel : FullyAutomated
Name : cluster01.vmware.local
CustomFields : {[VEEAM_Business_Unit, ], [VEEAM_Department, ], [VE
EAM_Purpose, ]}
ExtensionData : VMware.Vim.ClusterComputeResource
Id : ClusterComputeResource-domain-c7
Uid : /VIServer=@vcenter1.vmware.local:443/Cluster=Cluste
rComputeResource-domain-c7/
This quick and dirty script should list the levels regardless of the reservations being in percent or hosts:
$cluster = Get-Cluster
write-host -Foregroundcolor Cyan "HA Failover settings"
# check if cluster uses percentage or not..
If($cluster.HAAdmissionControlEnabled -eq "True" -and $cluster.HAFailOverLevel -eq "0") {
Write-Host "CPU:" $cluster.ExtensionData.Configuration.DasConfig.AdmissionControlPolicy.CpuFailoverResourcesPercent"%"
Write-Host "MEM:" $cluster.ExtensionData.Configuration.DasConfig.AdmissionControlPolicy.MemoryFailoverResourcesPercent"%"
} else {
Write-Host "Host reservations:" $cluster.HAFailOverLevel
}
Enjoy, if anyone wondered about it
Too bad we can't get the slot sizes any more.. 😕
Your script will only work if you have only one cluster.
Are these the sizes you are looking for ?
$Cluster.ExtensionData.RetrieveDasAdvancedRuntimeInfo() | Select -ExpandProperty SlotInfo
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
True that
Here's the improved one:
$clusters = Get-Cluster
write-host -Foregroundcolor Cyan "HA Failover settings"
# check if cluster uses percentage or not..
foreach($cluster in $clusters) {
Write-Host "Cluster: " $cluster.Name
If($cluster.HAAdmissionControlEnabled -eq "True" -and $cluster.HAFailOverLevel -eq "0") {
Write-Host " - CPU:" $cluster.ExtensionData.Configuration.DasConfig.AdmissionControlPolicy.CpuFailoverResourcesPercent"%"
Write-Host " - MEM:" $cluster.ExtensionData.Configuration.DasConfig.AdmissionControlPolicy.MemoryFailoverResourcesPercent"%"
} else {
Write-Host " - Host reservations:" $cluster.HAFailOverLevel
}
}
This is however just a part of my script, it currently is about 250 lines and counting. Thanks for the input!
LucD wrote:
Are these the sizes you are looking for ?
$Cluster.ExtensionData.RetrieveDasAdvancedRuntimeInfo() | Select -ExpandProperty SlotInfo
I'm afraid that doesn't help:
Select-Object : Property "SlotInfo" cannot be found.
At line:1 char:70
+ $Cluster.ExtensionData.RetrieveDasAdvancedRuntimeInfo() | Select <<<< -ExpandProperty SlotInfo
+ CategoryInfo : InvalidArgument: (VMware.Vim.ClusterDasAdvancedRuntimeInfo:PSObject) [Select-Object], PSArgumentException
+ FullyQualifiedErrorId : ExpandPropertyNotFound,Microsoft.PowerShell.Commands.SelectObjectCommand
I tried getting more info, and this is all I found on that call:
PowerCLI E:\> $Cluster.ExtensionData.RetrieveDasAdvancedRuntimeInfo() | Select *
| fl
DasHostInfo :
HeartbeatDatastoreInfo : {VMware.Vim.DasHeartbeatDatastoreInfo, VMware.Vim.DasH
eartbeatDatastoreInfo}
DynamicType :
DynamicProperty :
Seems they have hidden it well!
If I change the admission control policy to 1 host failure tolerated instead of the 30% CPU/MEM reservation I had before, I can see the info:
PowerCLI E:\> $Cluster.ExtensionData.RetrieveDasAdvancedRuntimeInfo() | Select *
| fl
SlotInfo : VMware.Vim.ClusterDasFailoverLevelAdvancedRuntimeInfoS
lotInfo
TotalSlots : 488
UsedSlots : 228
UnreservedSlots : 211
TotalVms : 228
TotalHosts : 10
TotalGoodHosts : 10
HostSlots : {VMware.Vim.ClusterDasFailoverLevelAdvancedRuntimeInfo
HostSlots, VMware.Vim.ClusterDasFailoverLevelAdvancedR
untimeInfoHostSlots, VMware.Vim.ClusterDasFailoverLeve
lAdvancedRuntimeInfoHostSlots, VMware.Vim.ClusterDasFa
iloverLevelAdvancedRuntimeInfoHostSlots...}
DasHostInfo :
HeartbeatDatastoreInfo : {VMware.Vim.DasHeartbeatDatastoreInfo, VMware.Vim.DasH
eartbeatDatastoreInfo}
DynamicType :
DynamicProperty :
So it seems that using percentage limits the information you can get from PowerCLI, perhaps intentionally or perhaps a bug..