Hello All;
could anyone guide me on creating a script to check High Availability configuration on multiple clusters, especially , Host Monitoring , Host failure response,admission control, Heartbeat Datastore configuration etc, i could not find any commandlets in powercli which can show these configuration
appreciate your response ..
thanks
jooshil
Oops, forgot to put that one in.
Just updated the code above.
Note that there are other settings when this is set to "Restart VMs", for now they are not yet in the report.
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
You can use the Get-Cluster cmdlet to retrieve HA settings on multiple clusters, for example with the following PowerCLI command:
Get-Cluster | Select-Object -Property Name,HAEnabled,
@{Name='HostMonitoring';Expression={$_.ExtensionData.Configuration.DasConfig.HostMonitoring}},
@{Name='AdmissionControlPolicyCpuFailoverResourcesPercent';Expression={$_.ExtensionData.Configuration.DasConfig.AdmissionControlPolicy.CpuFailoverResourcesPercent}},
@{Name='HeartbeatDatastore';Expression={(Get-View -Id $_.ExtensionData.Configuration.DasConfig.HeartbeatDatastore).Name}}
This is one I'm using, it gives some more details, but still not the full set.
Get-Cluster |
Select Name,HAAdmissionControlEnabled,
@{N='Host failures cluster tolerates';E={$_.ExtensionData.Configuration.DasConfig.AdmissionControlPolicy.FailOverLevel}},
@{N='Define host failover capacity by';E={
switch($_.ExtensionData.Configuration.DasConfig.AdmissionControlPolicy.GetTYpe().Name){
'ClusterFailoverHostAdmissionControlPolicy' {'Dedicated Failover Hosts (H)'}
'ClusterFailoverResourcesAdmissionControlPolicy' {'Cluster Resource Percentage (R)'}
'ClusterFailoverLevelAdmissionControlPolicy' {'Slot Policy (s)'}
}}},
@{N='(H) Failover Hosts ';E={(Get-View -Id $_.ExtensionData.Configuration.DasConfig.AdmissionControlPolicy.FailOverHosts -Property Name).Name -join '|'}},
@{N='(R) Override calculated failover capacity';E={
if($_.ExtensionData.Configuration.DasConfig.AdmissionControlPolicy.AutoComputePercentages){'True'}
else{'False (R-O)'}}},
@{N='(R-O) CPU %';E={$_.ExtensionData.Configuration.DasConfig.AdmissionControlPolicy.CpuFailoverResourcesPercent}},
@{N='(R-O) Memory %';E={$_.ExtensionData.Configuration.DasConfig.AdmissionControlPolicy.MemoryFailoverResourcesPercent}},
@{N='(S) Slot Policy ';E={
if($_.ExtensionData.Configuration.DasConfig.AdmissionControlPolicy.SlotPolicy){'Fixed Slot Size (S-F)'}
else{'Cover all powered-on VM'}
}},
@{N='(S-F) CPU MhZ';E={$_.ExtensionData.Configuration.DasConfig.AdmissionControlPolicy.SlotPolicy.Cpu}},
@{N='(S-F) Memory MB';E={$_.ExtensionData.Configuration.DasConfig.AdmissionControlPolicy.SlotPolicy.Memory}},
@{N='HA Admission Policy ResourceReductionToToleratePercent';E={$_.ExtensionData.Configuration.DasConfig.AdmissionControlPolicy.ResourceReductionToToleratePercent}},
@{N='Hearthbeat Datastore Policy';E={
switch($_.ExtensionData.Configuration.DasConfig.HBDatastoreCandidatePolicy){
'allFeasibleDs' {'Automatically select datastores accessible from the host'}
'allFeasibleDsWithUserPreference' {'Use datastores from the specified list and complement automatically (L)'}
'userSelectedDs' {'Use datastores only from the specified list (L)'}
}
}},
@{N='(L) Hearthbeat Datastore';E={(Get-View -Id $_.ExtensionData.Configuration.DasConfig.HeartbeatDatastore -property Name).Name -join '|'}},
@{N='Host Monitoring';E={$_.ExtensionData.Configuration.DasConfig.HostMonitoring}},
@{N='Host Failure Response';E={
if($_.ExtensionData.Configuration.DasConfig.DefaultVmSettings.RestartPriority -eq 'disabled'){'Disabled'}
else{'Restart VMs'}}},
@{N='Host Isolation Response';E={$_.ExtensionData.Configuration.DasConfig.DefaultVmSettings.IsolationResponse}},
@{N='Datastore with PDL';E={$_.ExtensionData.Configuration.DasConfig.DefaultVmSettings.VmComponentProtectionSettings.VmStorageProtectionForPDL}},
@{N='Datastore with APD';E={$_.ExtensionData.Configuration.DasConfig.DefaultVmSettings.VmComponentProtectionSettings.VmStorageProtectionForAPD}},
@{N='VM Monitoring';E={$_.ExtensionData.Configuration.DasConfig.VmMonitoring}}
Since you can select from multiple admission policies, and since not all properties are meaningful in all cases, I use letter codes to indicate which other properties are valid.
And this allows me to have a uniform result layout, while covering all the possibilities.
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Thanks Luc, let me try this out...
wondering how we can retrieve "Host Failure Response" data as well using the script,
Oops, forgot to put that one in.
Just updated the code above.
Note that there are other settings when this is set to "Restart VMs", for now they are not yet in the report.
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Hello,
I am confused how it is fetching Host failure response. As $cluster.ExtensionData.Configuration.Dasconfig.DefaultVmSettings.RestartPriority does not have values as Disabled..
And am unable to find a setting or class that gives me the actual Failure Response value. See Below:
I'm afraid you are looking at the wrong field.
This
corresponds with this
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Okay I am new to this... I got your logic now. I got confused, since when I try to get values for RestartPriority it was giving 'Medium'..
One question, set-cluster doesn't give many option to set these parameters, so is there any other way to modify this settings for automating the configuration.
Thank you,
Mahi
The PowerCLI cmdlets aim to give you the most used options.
To be able to configure all the possible options, you will have to use the vSphere API methods.
In this case that would be ReconfigureCluster method.
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
LucD I usually don't want to necro a year old thread. I am needing a similar script for the DRS cluster settings as well. I have searched without much luck for one that has the same level of details. I can open a new question if you would prefer.
David Griswold
PayPal
Yes, please (new thread).
Makes it easier for others to search.
Specify exactly what you want changed/different (you can refer to this one via a link).
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference