VMware Cloud Community
Gabrie1
Commander
Commander
Jump to solution

Script to view HA heartbeat datastores

Noticing an unexpected behaviour, at least to me, when querying for the datastores HA is using for heartbeat. I query the cluster HA setting for the datastores it is using for heartbeat and the result doesn't always match what is shown in the vSphere HA Heartbeat monitoring. But maybe I'm looking at the wrong value.

$clusterView = $cluster | get-view
$clusterView.Configuration.DasConfig.HeartbeatDatastore

This shows me the datastores that HA should use for heartbeat. I'm just not sure if this is the running value (because that doesn't always match) or just the configured value and therefore not matches the datastores mentioned in the vSphere Web interface -> cluster -> monitor -> vSphere HA -> Heartbeat.

Anyone know if there is a different value I should query?

 

Some background info: We're moving to new storage arrays and after storage VMotioning datastores and wanting to unmount, our engineers often get the message the the datastore is still in use for HA heartbeating. So I wanted to report them the HA heartbeat datastores so they can change this before working on that cluster.

http://www.GabesVirtualWorld.com
0 Kudos
1 Solution

Accepted Solutions
LucD
Leadership
Leadership
Jump to solution

You have to call the RetrieveDasAdvancedRuntimeInfo method to get at that info.
Something like this

$clusterName = 'cluster'
$cluster = Get-Cluster -Name $clusterName


$haConf = $cluster.ExtensionData.RetrieveDasAdvancedRuntimeInfo()
Get-View -Id $haConf.HeartbeatDatastoreInfo.Datastore | Select Name

 


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

View solution in original post

5 Replies
LucD
Leadership
Leadership
Jump to solution

You have to call the RetrieveDasAdvancedRuntimeInfo method to get at that info.
Something like this

$clusterName = 'cluster'
$cluster = Get-Cluster -Name $clusterName


$haConf = $cluster.ExtensionData.RetrieveDasAdvancedRuntimeInfo()
Get-View -Id $haConf.HeartbeatDatastoreInfo.Datastore | Select Name

 


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

Gabrie1
Commander
Commander
Jump to solution

Thanks!!! Worked.

http://www.GabesVirtualWorld.com
0 Kudos
ITSavant
Contributor
Contributor
Jump to solution

Any idea how to list the Heartbeat datastores when the policy is set to "allFeasibleDsWithUserPreference"?

PS C:\> $ClusterView.ConfigurationEx.DasConfig | Select Enabled, Option, HeartbeatDatastore, HBDatastoreCandidatePolicy | FL

Enabled : True
Option :
HeartbeatDatastore :
HBDatastoreCandidatePolicy : allFeasibleDsWithUserPreference

 

PS C:\> $ClusterView.RetrieveDasAdvancedRuntimeInfo() | FL

DasHostInfo :
VmcpSupported : VMware.Vim.ClusterDasAdvancedRuntimeInfoVmcpCapabilityInfo
HeartbeatDatastoreInfo :

 

 

0 Kudos
ITSavant
Contributor
Contributor
Jump to solution

NM I realized I had randomly selected a cluster with all VMhosts in Maintenance Mode

0 Kudos
LucD
Leadership
Leadership
Jump to solution

According to the API Reference, the selected datastores in that case should also be returned by the RetrieveDasAdvancedRuntimeInfo method.
Under 
ClusterDasConfigInfo in the heartbeatDatastore property it says

"The final set of selected heartbeat datastores is reported via heartbeatDatastoreInfo."

But your query seems to return an empty heartbeatDatastoreInfo property.
Strange 🤔

Update: ok, problem solved 😊


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

0 Kudos