Hyper-V

Edition: PROPro ENTERPRISEEnterprise

What it does

The Hyper-V connector reads a Microsoft Hyper-V host and keeps NetBox in step with it. Each run reads the host, its virtual switches and its virtual machines with their network adapters, VLANs and disks, then makes a plan of what would change in NetBox. Nothing is written until an operator applies the plan (see Collect, review and approve).

cinqstack reads the host over SSH (OpenSSH Server, built into Windows Server 2019 and later) and runs only read commands. Nothing is installed, changed or written on the host. Every command it runs is listed on What each connector reads.

When a plan is applied, cinqstack writes:

In NetBoxWhat is written
ClustersThe host's cluster, with the cluster type set on the job: the Windows failover cluster the host belongs to, by its name; a host that is in none is its own cluster, named after the host.
Virtual machinesName, status, site, cluster, host device, vCPUs, memory (the VM's startup memory), platform (the guest OS), tenant, tag, and the first line of the VM's notes as its description.
VM interfacesOne per network adapter, numbered in order (Network Adapter 1, Network Adapter 2), with its MAC address, connected or not, the virtual switch in the description, and the adapter's access VLAN as its untagged VLAN.
IP addressesThe addresses the guest reports, with their prefix length, and the guest's DNS name. The first IPv4 address becomes the VM's primary IP.
Virtual disksOne per virtual hard disk, named by its controller slot (for example SCSI 0:0), with its size.
The Hyper-V hostOnly when it already exists as a NetBox device: serial, cluster, platform (the Windows edition) and the management IP, on an interface named after the host's virtual Ethernet adapter, for example vEthernet (OT-EXT).

Power state maps to NetBox status: Running is Active; Off, Saved and Paused are Offline.

Guest data. The guest OS, the DNS name and the IP addresses come from the guest itself, through the Hyper-V Data Exchange (KVP) integration service. Windows guests report them out of the box. Linux guests need the Hyper-V daemons (hv_kvp_daemon, in the linux-cloud-tools or hyperv-daemons package). Appliances often report nothing: their VMs are still synced, without guest OS, DNS name or addresses.

Identity. Every object the sync owns carries the hyperv_id custom field: the host's hardware ID and the VM's own ID. A renamed VM is therefore an update, never a duplicate. Objects already in NetBox without the field are adopted on first match: a VM by name within its site, the host by serial and then by short name, a cluster by name within its site.

Changes between runs. Each run compares the host with the previous run of the same job and records every VM that was added, removed or changed. Guest details that disappear because the guest stopped reporting (VM off, integration services stopped) are left out. Each change gets risk labels and waits for someone to acknowledge it (see VM changes).

What it needs in NetBox

Created on demand, if missing: the cluster type, platforms (one per guest OS and Windows edition) and the hyperv-orphan tag.

If the optional last_synced and sync_source fields exist, each written VM and host gets the time and cinqstack Hyper-V sync.

Setting up

1. Prepare the host

On the Hyper-V host:

2. Add a connection

An admin opens Connectors › Hyper-V and clicks Connections. Each connection is one Hyper-V host.

FieldWhat to enter
NameA name for the list, for example "Halden Hyper-V 01". Blank uses the host.
HostThe host name or IP address, for example hv01.halden.example.
SSH port22 by default.
UsernameThe cinqstack account, for example svc-cinqstack or HALDEN\svc-cinqstack.
PasswordThe account's password, or the passphrase of the private key. Stored encrypted.
Private keyOptional: an OpenSSH private key (Ed25519, ECDSA or RSA) instead of a password. Stored encrypted.

Then choose:

A connection that a job uses cannot be deleted: That connection is used by a job.

3. Create a job

An operator or admin clicks New job on the Connectors › Hyper-V page.

FieldDefaultWhat it does
NameA name for the job.
Hyper-V hostThe connection to read.
NetBox cluster typeMicrosoft Hyper-VThe cluster type for new clusters. Created if missing.
VM names*Which VMs to read, as a pattern such as PLANT-*. The filter runs on the host: other VMs are never read.
Guest OS, DNS name and IP addresses from the guestsonReads the KVP data. Turn it off if the host is slow to answer it.
Time limit per step (s)60Each part of the read (VMs, adapters, disks) stops after this long; the rest of the run goes on. Guest data has its own limit: it stops after 30 seconds.
Time limit for the whole read (s)240The read on the host ends after this long, whatever is still running.
The Hyper-V host (serial, cluster, Windows version, management IP) when it exists in NetBoxonWrites host details to the matching device.
VM network adapters, MAC addresses and access VLANsonWrites VM interfaces.
Guest IP addresses, DNS names and primary IPonWrites the addresses the guests report. Needs interfaces on.
Skip IPs of powered-off VMsoffLeaves addresses alone for VMs that are not running.
Virtual disksonWrites virtual disks.
VMs that disappear from Hyper-VMark offline and tag hyperv-orphanOr Leave them alone. VMs are never deleted.
EnabledonA disabled job is not run by its schedule.

Schedule, What happens after a run and Safety limit work as for every sync job (see vCenter).

4. Add scope rules

Scope rules decide which VMs go to which NetBox site. Rules run top to bottom (lowest Order first) and the first match wins. A rule with no site excludes what it matches. Anything no rule matches is left out.

WhenMatches on
Host name matches (regex)The Hyper-V host name. Also places the host's own cluster.
Cluster name matches (regex; a standalone host is its own cluster)The failover cluster's name, or for a standalone host its own name.
VM name matches (regex)The VM name.
Everything elseAnything still unmatched.

For a host whose VMs all belong to one site, one Host name rule is enough. Patterns ignore upper and lower case.

5. Run it

On the Connectors › Hyper-V page, click Run now beside the job, or use the arrow next to it and choose Run with debug log. Scheduled runs start on their own.

To collect through a Relay edge ENTERPRISEEnterprise, route the job under Connectors › Relay › Routes. The edge then connects to the host over SSH; the password and key travel sealed.

Problems with SSH, rights or slow hosts are covered in Hyper-V troubleshooting.

Reading the results

The run page

Each run has a page at /hyperv/runs/<run id>, with the same status, tiles, report, plan and apply result as a vCenter run.

The report has one group of its own: Some details could not be read from the host. It lists each part of the read that timed out or was refused, and VMs whose guests report no KVP data. The rest of the inventory is complete.

A run with nothing to write ends as analysed rather than waiting for review. When the host's answer looks incomplete (no VMs where the last run had some, or far fewer), nothing is retired: the report shows Looked gone, kept this run, the run waits for review whatever the automation level, and the next complete run decides again. When the connection now reaches a different host, that run is a fresh baseline and no VM is reported as removed.

VM changes

Each recorded VM change appears under Review › Changes (filter on Virtual machines) with the device and vCenter changes; the Connectors › Hyper-V page shows how many wait, with a link there. Each opens a page with what changed (before and after), the VM's power, vCPUs, memory and disk, its host, site and addresses, its network adapters, and earlier changes to the same VM.

An operator or admin acknowledges a change with an optional Ticket and Note, then Acknowledge, or several at once on Review › Changes. cinqstack then writes a journal entry on the VM in NetBox naming who acknowledged it, the ticket and the note (unless journal entries are turned off). A VM removed before it ever reached NetBox gets no entry.

Findings it raises

Findings appear in the Findings inbox PROPro.

From the Hyper-V connector:

FindingSeverity
Hyper-V host <name> is not in NetBoxLow
<VM>: <risk labels>, one per VM change not yet acknowledgedThe change's highest risk, below

The Virtual view of the topology draws Hyper-V hosts and VMs next to vCenter's, and raises the same checks on them (zone mixing on a host, VMs with adapters in OT and IT networks, VLANs a host's switch port does not carry). Each vSwitch and VLAN pair is drawn as one network.

Risk labels on a VM change. A VM counts as part of the control system when its name, NetBox role, notes or guest DNS name contain words such as SCADA, HMI, historian, EWS, PLC, OPC, DCS, MES or safety.

LabelSeverity
Control-system VM removed from Hyper-V, Control-system VM powered off, stopped (saved) or stopped (paused)High
VM removed from Hyper-V, VM powered off, stopped (saved) or stopped (paused)Medium
New VM on OT VLAN … (a VLAN classified level 0 to 3)High
New VMLow
Moved off an OT network, from VLAN … to VLAN …, Moved onto an OT network, from VLAN … to VLAN …High
VLAN changed, from VLAN … to VLAN …, vSwitch changed (same VLAN)High for a control-system VM or an OT VLAN, otherwise medium
Network adapter disconnectedHigh for a control-system VM, otherwise medium
Network adapter added, removed or reconnected, IP address changedMedium
Resources changed, Renamed, Guest OS changedLow

Limits