Closed baguilar951 closed 2 years ago
This is probably the main issue: https://github.com/bb-Ricardo/netbox-sync/blob/c26b726ba6659917fd73863f110add44141cd881/settings-example.ini#L142-L150
Also here under IMPORTANT
: https://github.com/bb-Ricardo/netbox-sync/blob/main/docs/source_vmware.md#setup
ESXi Virtual interfaces are not really a "child" interface of a certain physical interface. Thats why they are created as virtual interfaces.
You need to define cluster_site_relation
in your settings properly and try to run the script again. But It can cause issues with objects that have been created through the script already.
Best is to switch back to a database state before the first sync.
Hi @bb-Ricardo,
Thank you for the docs, I probably should have gone deeper in the docs. I was able to get the inventory imported into the correct Site now. I am still encountering this error when the plugin is trying to create the VMK virtual interfaces:
2021-11-09 02:56:33,972 - INFO: Updating NetBox 'interface' object 'vmk3 (nutanix-6-esx.~domain~)' with data: {'name': 'vmk3', 'type': 'virtual', 'mtu': 9000, 'mac_address': '00:50:56:xx:xx:xx', 'description': 'PROD-BB-1 (10 Gb 1, vlan ID: 4)', 'mode': 'access', 'untagged_vlan': 67, 'tags': [{'name': 'NetBox-synced'}, {'name': 'Source: vCenter Prod'}]}
2021-11-09 02:56:33,972 - DEBUG2: Sending PATCH to 'https://racktables-test.~domain~/api/dcim/interfaces/62/' with data 'b'{"name": "vmk3", "type": "virtual", "mtu": 9000, "mac_address": "00:50:56:xx:xx:xx", "description": "PROD-BB-1 (10 Gb 1, vlan ID: 4)", "mode": "access", "untagged_vlan": 67, "tags": [{"name": "NetBox-synced"}, {"name": "Source: vCenter Prod"}]}''.
2021-11-09 02:56:34,050 - DEBUG2: Received HTTP Status 400.
2021-11-09 02:56:34,051 - ERROR: NetBox returned: PATCH /api/dcim/interfaces/62/ Bad Request
2021-11-09 02:56:34,051 - ERROR: NetBox returned body: {'type': ['Virtual interfaces cannot have a cable attached.']}
2021-11-09 02:56:34,051 - ERROR: Request Failed for interface. Used data: {'name': 'vmk3', 'type': 'virtual', 'mtu': 9000, 'mac_address': '00:50:56:xx:xx:xx', 'description': 'PROD-BB-1 (10 Gb 1, vlan ID: 4)', 'mode': 'access', 'untagged_vlan': 67, 'tags': [{'name': 'NetBox-synced'}, {'name': 'Source: vCenter Prod'}]}
The issue seems to stem from the fact that we have already existing interfaces which we created when we first created the host devices in netbox. With some of the hosts, it replaced and overwrote our original interfaces we created which is okay I guess, though we didn't even have MAC addresses documented in netbox so I am not sure how the script determined it was okay to overwrite the existing interface information. It also deleted/overwrote our documented iDRAC interfaces for some Dell machines, so that was very interesting. It looks like the order in which the interfaces were created originally is what the plugin uses to create and overwrite the existing ones.
This is our production netbox instance with the existing information:
After the sync in our test instance:
I understand that in some environments, VMK interfaces are logically not children of a particular physical interface, but rather children of a virtual switch. If the VMK holds the IP information and it is connected through a particular vSwitch on 1 or more uplinks, I would imagine it would be easy to place the VMK as a virtual interface under a VMNIC. If there isn't anything that can be done to add this in the plugin, that is okay. I wish Netbox had a way to create and assign virtual switches natively. Assigning the physical uplinks and then the virtual interfaces under the PHY would be very logical for our environment.
Hi,
to your first question I can refer to the source code(you might need to scroll): https://github.com/bb-Ricardo/netbox-sync/blob/c26b726ba6659917fd73863f110add44141cd881/module/sources/common/source_base.py#L38-L58
for your second question: currently you can only assign ONE parent interface to a virtual interface. I would be the wrong information as there can be one, two ore more interfaces parent of a virtual interface.
In general you might want to skip syncing the hosts at all. You seem to have everything already documented. Add just sync the VM information.
In general you might want to skip syncing the hosts at all. You seem to have everything already documented. Add just sync the VM information.
This is a good idea to have a switch that we can exclude the hosts. Should I open a feature request?
Hi, It's already there. Set host_exclude_filter
to .*
, then no host should be synced to NetBox.
Can I close this issue?
closing this issue due to no reply.
Hello,
Encountering these errors when running a sync of the inventory on a particular vCenter:
^ Presumably, and from what has been comitted to Netbox, the synchronization creates a new site with the name vCenter: My Example vCenter and the sync is trying to update the details of a device that obviously does not exist under that site name but does exist under another site with the proper name.
The other issue is:
^ Not sure why this is trying to update a physical interface that exists or trying to connect a cable to a virtual interface, ideally the flexibility to create a vmnic under the physical interface in Netbox by creating a child under said physical interface is a much more logical solution here.
Let me know if I am missing a configuration somewhere.