You need to have a source section in your settings.ini
file with following type:
type = vmware
All options for this source are described in the settings-example.ini file.
If you have multiple vCenter instances just add another source with the same type in the same file.
IMPORTANT: For VMware source you should define the var cluster_site_relation
which maps a vCenter cluster to an
exiting Site in NetBox. If undefined a placeholder site will be created.
You need a user account with "Read-only" role on vCenter root scope. The "Propagate to children" setting must also be checked.
To match new/updated objects to existing objects in NetBox a few different steps are taken to find the correct object.
You might be interested in this description. This describes how discovered IP addresses and interfaces will be added to NetBox.
Try to find object first based on the object data, interface MAC addresses and primary IPs.
- try to find by name and cluster/site
- try to find by mac addresses interfaces
- try to find by serial number (1st) or asset tag (2nd) (ESXi host)
- try to find by primary IP
If this NetBox object (device, vm) matches, the found object will be used.
Iterate over all NetBox interfaces of an object (device, vm) and compare MAC address with list of MAC addresses discovered for this object. If a match was found, count for every object (device, vm) how many MAC addresses are matching.
If exactly one NetBox object (device, vm) with matching interface MACs was found then this one will be used.
If two or more NetBox object (device, vm) with matching MACs were found, compare the two NetBox object (device, vm) with the highest amount of matching interfaces. If the ratio of matching interface MAC addresses exceeds 2.0 then the top matching NetBox object (device, vm) is chosen as desired object.
If the ratio is below 2.0 then None will be chosen. The probability is to low that this one is the correct one.
If an exact matching NetBox object (device, vm) was found the object will be used immediately without checking the other primary IP address (if defined).
Simple, nothing special going on here
Cluster name is checked against cluster_include_filter
and cluster_exclude_filter config
setting.
This is done to extract name and VLAN IDs from each port group
First host is filtered:
- host has a cluster and this cluster is permitted
- skip host with same name and site, we already parsed it (use unique host names)
- does the host pass the
host_include_filter
andhost_exclude_filter
Then all necessary host data will be collected:
host model, manufacturer, serial, physical interfaces, virtual interfaces,
virtual switches, proxy switches, host port groups, interface VLANs, IP addresses
Primary IPv4/6 will be determined by
- if the interface port group name contains "management" or "mngt"
- interface with this IP is the default route of this host
Iterate over all VMs twice!
To handle VMs with the same name in a cluster we first iterate over all VMs and look only at the active (online) ones and parse these first. Then we iterate a second time to catch the rest (also offline).
This has been implemented to support migration scenarios where you create/copy the same machine with a different setup like a new version or something. This way NetBox will be updated primarily with the actual active VM data.
First VM is filtered:
- VM has a cluster and is it permitted
- skip VMs with same name and cluster if already parsed
- does the VM pass the
vm_include_filter
andvm_exclude_filter
Then all necessary VM data will be collected:
platform, virtual interfaces, virtual cpu/disk/memory interface VLANs, IP addresses
Primary IPv4/6 will be determined by interface that provides the default route for this VM.
Note:
IP address information can only be extracted if guest tools are installed and running.