VMware Cloud Community
nicholas1982
Hot Shot
Hot Shot
Jump to solution

Query and Set HA Settings

Hi All,

I need to query and possibly set HA settings in particular " Heartbeat Monitoring Sensitivity" (See Screenshot Attached)

Nicholas
1 Solution

Accepted Solutions
LucD
Leadership
Leadership
Jump to solution

Try like this, there are in fact three possible combinationes (Low, Medium and High)

$clusterName = 'MyCluster'

$HMSensitivity = @(

    @{

    Name = 'Low'

    MinUptime = 480

    FailureInterval = 120

    MaxFailureWindow = 604800

    },

    @{

    Name = 'Medium'

    MinUptime = 240

    FailureInterval = 60

    MaxFailureWindow = 86400

    },

    @{

    Name = 'High'

    MinUptime = 120

    FailureInterval = 30

    MaxFailureWindow = 3600

    }

)

# Query the setting

$cluster = Get-Cluster -Name $clusterName

$cluster | Select Name,

    @{N='Heartbeat Monitoring Sensitivity';E={

        $sensitivity = $HMSensitivity | where{$_.MinUptime -eq $cluster.ExtensionData.ConfigurationEx.DasConfig.DefaultVmSettings.VmToolsMonitoringSettings.MinUpTime}

        $sensitivity['Name']

    }}

# Change the setting

$request = 'Low'   # Use Low, Medium or High

$sensitivity = $HMSensitivity | where{$_.Name -eq $request}

$spec = New-Object VMware.Vim.ClusterConfigSpec

$spec.DasConfig = New-Object VMware.Vim.ClusterDasConfigInfo

$spec.DasConfig.DefaultVmSettings = New-Object VMware.Vim.ClusterDasVmSettings

$spec.DasConfig.DefaultVmSettings.VmToolsMonitoringSettings = New-Object VMware.Vim.ClusterVmToolsMonitoringSettings

$spec.DasConfig.DefaultVmSettings.VmToolsMonitoringSettings.MinUpTime = $sensitivity['MinUpTime']

$spec.DasConfig.DefaultVmSettings.VmToolsMonitoringSettings.FailureInterval = $sensitivity['FailureInterval']

$spec.DasConfig.DefaultVmSettings.VmToolsMonitoringSettings.MaxFailureWindow = $sensitivity['MaxFailureWdinow']

$cluster.ExtensionData.ReconfigureCluster($spec,$true)

# Query the setting

$cluster = Get-Cluster -Name $clusterName

$cluster  | Select Name,

    @{N='Heartbeat Monitoring Sensitivity';E={

        $sensitivity = $HMSensitivity | where{$_.MinUptime -eq $cluster.ExtensionData.ConfigurationEx.DasConfig.DefaultVmSettings.VmToolsMonitoringSettings.MinUpTime}

        $sensitivity['Name']

    }}


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

View solution in original post

0 Kudos
11 Replies
LucD
Leadership
Leadership
Jump to solution

Try like this, there are in fact three possible combinationes (Low, Medium and High)

$clusterName = 'MyCluster'

$HMSensitivity = @(

    @{

    Name = 'Low'

    MinUptime = 480

    FailureInterval = 120

    MaxFailureWindow = 604800

    },

    @{

    Name = 'Medium'

    MinUptime = 240

    FailureInterval = 60

    MaxFailureWindow = 86400

    },

    @{

    Name = 'High'

    MinUptime = 120

    FailureInterval = 30

    MaxFailureWindow = 3600

    }

)

# Query the setting

$cluster = Get-Cluster -Name $clusterName

$cluster | Select Name,

    @{N='Heartbeat Monitoring Sensitivity';E={

        $sensitivity = $HMSensitivity | where{$_.MinUptime -eq $cluster.ExtensionData.ConfigurationEx.DasConfig.DefaultVmSettings.VmToolsMonitoringSettings.MinUpTime}

        $sensitivity['Name']

    }}

# Change the setting

$request = 'Low'   # Use Low, Medium or High

$sensitivity = $HMSensitivity | where{$_.Name -eq $request}

$spec = New-Object VMware.Vim.ClusterConfigSpec

$spec.DasConfig = New-Object VMware.Vim.ClusterDasConfigInfo

$spec.DasConfig.DefaultVmSettings = New-Object VMware.Vim.ClusterDasVmSettings

$spec.DasConfig.DefaultVmSettings.VmToolsMonitoringSettings = New-Object VMware.Vim.ClusterVmToolsMonitoringSettings

$spec.DasConfig.DefaultVmSettings.VmToolsMonitoringSettings.MinUpTime = $sensitivity['MinUpTime']

$spec.DasConfig.DefaultVmSettings.VmToolsMonitoringSettings.FailureInterval = $sensitivity['FailureInterval']

$spec.DasConfig.DefaultVmSettings.VmToolsMonitoringSettings.MaxFailureWindow = $sensitivity['MaxFailureWdinow']

$cluster.ExtensionData.ReconfigureCluster($spec,$true)

# Query the setting

$cluster = Get-Cluster -Name $clusterName

$cluster  | Select Name,

    @{N='Heartbeat Monitoring Sensitivity';E={

        $sensitivity = $HMSensitivity | where{$_.MinUptime -eq $cluster.ExtensionData.ConfigurationEx.DasConfig.DefaultVmSettings.VmToolsMonitoringSettings.MinUpTime}

        $sensitivity['Name']

    }}


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

0 Kudos
nicholas1982
Hot Shot
Hot Shot
Jump to solution

Thanks Luc, this looks like it will do the trick.

On the flip side the amount of code required for just one cluster is overwhelming considering this is just a tiny bit of what I'm trying to build which a DSC health check.

I might be back for more help if I can't work out the rest, thanks again Luc.

Nicholas
0 Kudos
LucD
Leadership
Leadership
Jump to solution

That's the drawback when functionality is not available directly through a PowerCLI cmdlet.

The API methods most of the time do require a bit more code I'm afraid.

On the other hand it makes you appreciate the PowerCLI cmdlets even more :smileygrin:

And sure, feel free to ask!


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

0 Kudos
nicholas1982
Hot Shot
Hot Shot
Jump to solution

Hi Luc,

Just want say I tested it and works perfectly, in fact I was trying to query this last night but never thought to dive into "ConfigurationEx" of the extensionData. I also just checked out I can so many other things I need for my DSC health check. Smiley Happy

Nicholas
0 Kudos
LucD
Leadership
Leadership
Jump to solution

Quick question, does DSC stand for Desired State Configuration in this case?


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

0 Kudos
nicholas1982
Hot Shot
Hot Shot
Jump to solution

Yes, it does, I've recently become very fascinated with desired state. Imagine having to manage 200+ all flash VSAN nodes, NSX, Stretched vsan, the entire vRealize suite, 1000's VM's. desired state plays a huge role in maintaining compliance , resiliency, performance etc. I truly believe maintaining DSC against a VVD (VMware Validated Design) the end result is a robust bulletproof environment no matter big it is.

As side note, after getting really interested in DSC for VMware Infrastructure I stumbled across the DSC stuff you've been working on. DSC might not be buzz concept yet when it comes to VMware, but its only a matter of time.

Nicholas
0 Kudos
LucD
Leadership
Leadership
Jump to solution

Great to hear.

I'm planning a major update of my DSC resources in the coming weeks (just need to find some time).

The update will include guidelines on how to contribute.


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

0 Kudos
nicholas1982
Hot Shot
Hot Shot
Jump to solution

That's amazing, I totally get it, DSC is a beast and needs time, you've done amazing work Luc, looking forward to seeing more of this!

As side question my powershell skills are very limited but currently super keen to keep learning, my end goal is codify/automate infrastructure and maintain DSC.

Would you recommend this book, is there a new addition I should wait for?

VMware vSphere PowerCLI Reference: Automating vSphere Administration

Nicholas
0 Kudos
LucD
Leadership
Leadership
Jump to solution

That book is a reference, so it is not a learning guide.
It tries to cover all aspects of your vSphere admin tasks. and how you can automate these through PowerCLI.

Make sure to get the 2nd edition, which was released last year, and contains new and updated chapters.


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

nicholas1982
Hot Shot
Hot Shot
Jump to solution

Cheers Luc

Nicholas
0 Kudos
_Parakiss_
Contributor
Contributor
Jump to solution

If you want to add a Heartbeat Datastore,

$spec.DasConfig.HeartbeatDatastore = $(Get-DataStore -Name “DatastoreName”).Id

0 Kudos