Looking at the VM Heartbeat with WMI
Virtual Server also exposes a fair amount of information on the virtual machine heartbeat through WMI. The virtual machine heartbeat is generated by Virtual Machine Additions when it is installed inside the virtual machine. This script returns all of the heartbeat related WMI counters for each virtual machine:
Set vsWMIObj = GetObject("winmgmts:\.rootvmvirtualserver")
Set vms = vsWMIObj.ExecQuery("SELECT * FROM VirtualMachine",,48)
For Each vm in vms
Wscript.Echo "Virtual machine: " & vm.Name
Wscript.Echo "Heartbeat Count: " & vm.HeartbeatCount
Wscript.Echo "Heartbeat Percentage: " & vm.HeartbeatPercentage
Wscript.Echo "Heartbeat Interval: " & vm.HeartbeatInterval
Wscript.Echo "Heartbeat Rate: " & vm.HeartbeatRate
Let's have a look at the counters that are used here:
- Heartbeat count is the total number of heartbeats received since the virtual machine was last started.
- Heartbeat Percentage is the percentage of expected heartbeats that were actually received in the last Heartbeat Interval (should be 100 if everything is well).
- Heartbeat Interval specifies the amount of time to be used for calculating the Heartbeat Percentage, and is measured in seconds.
- Heartbeat Rate specifies how often a heartbeat should be sent, in seconds. The default is 10 seconds.