What does "Enable heartbeat monitoring for the virtual machine" do ?

What does "Enable heartbeat monitoring for the virtual machine" do ?

  • Comments 4

 Hi,

 I've been asked this a couple of times, and thought it might be interesting to blog..

 If you have a R2 Hyper-V Host cluster, the Virtual Machine Resource has a property on the Settings page named "Heartbeat Setting" with an associated check box "Enable heartbeat monitoring for the virtual machine".

  

By default, this checking is not active. Let's see what it does and if you would have the requirement to enable it.

 

When you have a Virtual Machine with Integration Services installed, by default the Heartbeat Service is installed inside the Virtual Machine, and regularly notifies the Hyper-V host that it is alive.

If you'd enable "Enable heartbeat monitoring for the virtual machine", the cluster will reset the virtual machine should the heartbeat not arrive in a given timeframe (1minute).

 

That might be desirable, but can lead to a unwanted side effect:

 

When you shut down or restart the Virtual machine, the heartbeat service is stopped and does not send notifications to the Hyper-V Host anymore. So the Virtual Machine might be reset once during reboot.

 

As a workaround, configure a 2nd boot selection to have a boot selection menu, and a delay of 60 seconds. This will ensure that the reset is taken at a time, when it does not harm.

 

Cheers

Robert

 

For those of you interested in scripting, the Msvm_HeartbeatComponentSettings class holds two values, Latency and Interval, but the maximum accepted values are 6000 and 60000 ms.

 

# Invoke MSVM ManagmentService Class

$MgmtSvc = gwmi -namespace root\virtualization MSVM_VirtualSystemManagementService

 

 

$Server="."

$VMName = "YourVMName"

 

# Get the virtual machine object

$query = "Select * From Msvm_ComputerSystem Where ElementName='" + $VMName + "'"

$VM = gwmi -namespace root\virtualization -query $query -computername $Server

 

#Get the Heartbeat Component

$HeartbeatComponent = gwmi -query "associators of {$VM} where ResultClass = Msvm_HeartbeatComponent" -namespace root\virtualization

 

#Get the Settings collection from the Heartbeat Component

$HeartbeatSetting  = gwmi -query "associators of {$HeartbeatComponent} where ResultClass = Msvm_HeartbeatComponentSettingData" -namespace root\virtualization

 

$HeartbeatSetting.Latency = 6000

$HeartbeatSetting.Interval = 60*1000

 

#Write the Setting

$MgmtSvc.ModifyVirtualSystemResources($VM.__path,$HeartbeatSetting.GetText(1))

 

 

  • I am confused what virtual machine can do better than normal machine?

  • I'm not sure about your question ? Can u be more specific?

  • > If you'd enable "Enable heartbeat monitoring for the virtual machine", the cluster will reset the virtual

    > machine should the heartbeat not arrive in a given timeframe (1minute).

    What is the key to reset VM? (For example, 3 consecutive heartbeats lost.)

    Is there any configuration to change the given timeframe?

    In my environment, some VMs always detect heartbeats stop immediately (in a second), but others take several seconds less than 1 minute.  (I manually stop HB service.)

  • With the PS Script, you should be able to configure Interval of Heartbeats up to 60 seconds for each VM individually.

Page 1 of 1 (4 items)
Leave a Comment
  • Please add 1 and 7 and type the answer here:
  • Post