Skip to content

Hyper-V host over WinRM (win_hyperv_host) ​

Reads a Hyper-V host from the host itself, over WinRM or native WMI: whether the management service that runs every virtual machine is up, the health Hyper-V gives the host, how many machines exist and run, how busy the hypervisor is, and how much memory the host and its machines use. Nothing runs inside any machine, so a guest that has no agent or that has crashed is still counted. One sensor on each host covers it; the machines themselves are read by win_hyperv_vm and their disks by win_hyperv_storage.

Transport. Under a Windows probe the device can be set to read this sensor over native WMI instead of WinRM; the queries and the result are the same. The target is then set up as in the WMI setup guide instead.

What it looks like ​

The page of a win_hyperv_host sensor in the light theme

The sensor's page after a few polls, watching a Windows Server Hyper-V host with one small guest, reached over WinRM. In the dark theme: the sensor's page. The form for adding it: light, dark.

Channels ​

KeyNameUnitDefault limits
vmms_stateManagement service (vmms)Stopped is Down, a pending state is a warning
healthHost healthOK is Up, degraded and minor failure are warnings, major and critical failure are Down
vmsVirtual machinesnone
vms_runningVirtual machines runningnone
vms_unhealthyVirtual machines not healthywarning above 0
cpu_pctHypervisor load%warning above 85, error above 95
mem_used_pctHost memory used%warning above 85, error above 95
mem_free_mbHost memory freeMBnone
vm_memory_mbMemory held by machinesMBnone

While the management service (vmms) is stopped the Hyper-V provider answers with nothing or a fault, so the sensor reports the service state, goes Down (Warning while it starts or stops) and leaves every other channel unknown. A host that has no vmms service does not have the role, which fails the sensor as a configuration error.

The load is the hypervisor's, not the operating system's. The processor counters of the host's own operating system (the ones win_cpu reads) see only the root partition: on a host that is busy running guests they can read a few per cent. The sensor reads the hypervisor's logical processor counters (Win32_PerfRawData_HvStats_HyperVHypervisorLogicalProcessor) and takes the _Total instance, which adds the run time of every logical processor, guests and root together, so the percentage is that sum divided by the time that passed and the number of processors. Like every rate here it is an average between two polls: it is unknown for the first poll, after the host restarts, and when a counter went backwards.

vms_unhealthy counts machines whose HealthState is not 5 (OK). The message names up to five of them. vm_memory_mb is the memory of the machines that are running (Msvm_Memory); a machine that is off holds none.

Parameters ​

ParameterDefaultMeaning
port5985, or 5986 with httpsTCP port of the WinRM listener.
httpsfalseUse the HTTPS listener instead of HTTP with message encryption.
accept_self_signedfalseAccept an HTTPS certificate that cannot be verified. The credential has the same switch; either one is enough.

Suggested interval: 60 seconds. Credential: Windows, on the Hyper-V host. Discovery proposes this sensor, win_hyperv_storage and one win_hyperv_vm for each machine on every Windows host that has the Hyper-V Virtual Machine Management service set to start automatically. Machines that are off are listed but not selected, and are set not to expect running.

Where the data comes from ​

ChannelSource
vmms_stateWin32_Service named vmms, in root\cimv2.
health, vms, vms_running, vms_unhealthyMsvm_ComputerSystem in root\virtualization\v2: the row captioned Hosting Computer System is the host and every row captioned Virtual Machine is a machine.
cpu_pctWin32_PerfRawData_HvStats_HyperVHypervisorLogicalProcessor, raw counters, in root\cimv2.
mem_used_pct, mem_free_mbWin32_OperatingSystem (FreePhysicalMemory, TotalVisibleMemorySize).
vm_memory_mbMsvm_Memory, the rows owned by a machine.

The management service's own methods (for instance the one that returns a summary of every machine) cannot be called from an enumeration, which is all the WinRM and WMI clients here do, so nothing that only a method gives is reported. Everything above is a plain SELECT.

On the target ​

WinRM enabled and an account set up as in the WinRM setup guide, with the account also allowed to read root\virtualization\v2 (the guide's WMI steps for root\CIMV2, repeated for that namespace; membership of the local Hyper-V Administrators group gives the right) and a member of Performance Monitor Users, because the load is a performance counter. The checks below used a domain administrator; the narrower grants are not tested here.

Failures ​

The WinRM failures every Windows sensor shares are listed in the setup guide. Specific to this sensor:

MessageMeaning
there is no Hyper-V Virtual Machine Management service (vmms) on the target, so the Hyper-V role is not installed (kind config)The sensor was put on a machine without the role.
the Hyper-V management service is stopped (Down)The service is stopped; start it. While it is starting or stopping the sensor is a warning.
access denied (kind auth_failed)The account may not read root\virtualization\v2.

Verification ​

Checked against WS-Man responses recorded from a real Windows Server 2022 Hyper-V host with one running guest (the load counters read twice, a few seconds apart), and against that host live over NTLM with message encryption, with the guest running and with it turned off. The host is a virtual machine on a KVM workstation, so the Hyper-V role runs nested (see the Hyper-V storage page for what that took). The unhealthy host and machine, the stopped service and the host with no counters are written by hand in the tests, which say so. Not seen: a host that is under load, a clustered host, Server Core, a host with several NUMA nodes, a non-administrator account, and native WMI over DCOM.

Live tests: PROBEWARD_TEST_HYPERV_HOST, _USER, _PASSWORD and _VM (the name of a small machine on the host); PROBEWARD_TEST_HYPERV_EXPECT is running (the default) or stopped and says what state that machine is in, so the same tests are run before and after someone turns it off. They skip, saying so, when the variables are unset.

AGPL-3.0-only