Disable VM Heartbit Monitoring


In a Hyper-V Failover Cluster, when you have a VM with Integration Services installed, the VM Monitoring Heartbeat service inside the VM regularly notifies the Hyper-V host that it is alive.

This setting can be used to automatically recover from hung virtual machines, but it should not be enabled without fully understanding what it does.

(Note that when configuring a virtual machine using System Center Virtual Machine Manager, the setting is enabled by default).

If the Enable heartbeat monitoring for the virtual machine setting is enabled, and the heartbeat does not arrive in a given timeframe (by default – 1 minute) the cluster will reset the virtual machine.

Since there are situations where this setting can lead to unexpected reboots, you might prefer this setting to be disabled on all your VMs.

 

You could go ahead and disable the setting for each VM using the UI, but I assume you’d rather go with the PowerShell approach if you have tens, hundreds or even more VMs:

 

# To get all the VMs that have heartbeat monitoring enabled:
$ClusterResources = Get-ClusterResource  |
    Where-Object { $_.resourcetype -eq ‘virtual machine’} |
        Where-Object { $_ | Get-ClusterParameter CheckHeartbeat } |
            Where-Object { $_.value -ne 0 }
 
 
# To disable the heartbeat monitoring on all those VMs:
$ClusterResources |
    Set-ClusterParameter -Name CheckHeartbeat -Value 0
 
 
# To get the heartbeat monitoring status on all VMs:
Get-ClusterResource  |
    Where-Object { $_.resourcetype -eq ‘virtual machine’} |
        Get-ClusterParameter CheckHeartbeat
 
 

 

Many thanks to Israel Gofman for the PowerShell challenge.

HTH,

\Martin.

Comments (0)

Skip to main content