Closed plevart closed 2 years ago
Hi, can you run the Tool with the option -l DEBUG2
this will help to debug the issue.
Hm, it looks like the "fuzzy" matching logic incorrectly identifies a Device. I don't know how, though. This is, I think, the relevant part of the DEBUG2 log:
2022-04-25 10:10:13,329 - DEBUG: vCenter returned '3' hosts
2022-04-25 10:10:13,331 - DEBUG: Parsing vCenter host: esx5.marand.si
2022-04-25 10:10:13,334 - DEBUG2: Trying to find site name for device 'esx5.marand.si'
2022-04-25 10:10:13,334 - DEBUG2: Found a matching host_site_relation 'Posta' (esx[567].*) for esx5.marand.si.
2022-04-25 10:10:13,621 - DEBUG2: Found SerialNumberTag: YMLU009509
2022-04-25 10:10:13,621 - DEBUG2: Found ServiceTag: YMLU009509
2022-04-25 10:10:13,621 - DEBUG2: Found EnclosureSerialNumberTag: YMLU009509
2022-04-25 10:10:13,621 - DEBUG2: Found a matching host_tenant_relation 'MARAND, d.o.o.' (.*\.marand\.si) for esx5.marand.si.
2022-04-25 10:10:14,372 - DEBUG2: Found host proxySwitch Distributed Switch
2022-04-25 10:10:15,091 - DEBUG2: Parsing PhysicalNic: vmnic0
2022-04-25 10:10:15,091 - DEBUG2: Parsing PhysicalNic: vmnic1
2022-04-25 10:10:15,091 - DEBUG2: Parsing PhysicalNic: vmnic2
2022-04-25 10:10:15,091 - DEBUG2: Parsing PhysicalNic: vmnic3
2022-04-25 10:10:15,091 - DEBUG2: Parsing PhysicalNic: vmnic4
2022-04-25 10:10:15,091 - DEBUG2: Parsing PhysicalNic: vmnic5
2022-04-25 10:10:15,091 - DEBUG2: Parsing PhysicalNic: vmnic6
2022-04-25 10:10:15,091 - DEBUG2: Parsing PhysicalNic: vmnic7
2022-04-25 10:10:15,092 - DEBUG2: Parsing PhysicalNic: vmnic8
2022-04-25 10:10:15,092 - DEBUG2: Parsing PhysicalNic: vmnic9
2022-04-25 10:10:15,475 - DEBUG2: Parsing HostVirtualNic: vmk0
2022-04-25 10:10:15,475 - DEBUG2: Parsing HostVirtualNic: vmk5
2022-04-25 10:10:15,475 - DEBUG2: Parsing HostVirtualNic: vmk1
2022-04-25 10:10:15,475 - DEBUG2: Parsing HostVirtualNic: vmk2
2022-04-25 10:10:15,475 - DEBUG2: Parsing HostVirtualNic: vmk3
2022-04-25 10:10:15,476 - DEBUG2: Parsing HostVirtualNic: vmk4
2022-04-25 10:10:15,476 - DEBUG2: Trying to find a device based on the collected name, cluster, IP and MAC addresses
2022-04-25 10:10:15,476 - DEBUG2: No exact match found. Trying to find device based on MAC addresses
2022-04-25 10:10:15,476 - DEBUG2: No match found. Trying to find device based on serial number
2022-04-25 10:10:15,476 - DEBUG2: No match found. Trying to find device based on asset tag
2022-04-25 10:10:15,476 - DEBUG2: Found a matching device object: esx6.marand.si (Posta)
2022-04-25 10:10:15,476 - DEBUG2: Parsing 'device' data structure: esx5.marand.si
2022-04-25 10:10:15,477 - DEBUG2: Parsing 'device type' data structure: PRIMERGY RX2530 M5
2022-04-25 10:10:15,477 - DEBUG2: Parsing 'manufacturer' data structure: FUJITSU
2022-04-25 10:10:15,477 - DEBUG2: Parsing 'site' data structure: Posta
2022-04-25 10:10:15,477 - DEBUG2: Parsing 'cluster' data structure: FUJITSU Server PRIMERGY RX2530 M5
2022-04-25 10:10:15,477 - DEBUG2: Parsing 'platform' data structure: VMware ESXi 7.0.0
2022-04-25 10:10:15,477 - DEBUG2: Parsing 'tenant' data structure: MARAND, d.o.o.
2022-04-25 10:10:15,477 - INFO: Device 'esx5.marand.si' attribute 'name' changed from 'esx6.marand.si' to 'esx5.marand.si'
2022-04-25 10:10:15,477 - INFO: Device 'esx5.marand.si' attribute 'serial' changed from 'YMLU009510' to 'YMLU009509'
2022-04-25 10:10:15,477 - DEBUG: Updated device object: esx5.marand.si
I'm I correct to assume that the "fuzzy" matching logic finds a matching device only by it's site? I do have a mapping that yields the same site for all 3 hosts:
# Same as cluster site but on host level. If unset it will fall back
# to cluster_site_relation.
host_site_relation = esx[567].* = "Posta"
Location has nothing to do with it. It's the serial number with the enclosures. I assume these servers are blade servers?
mmhh, these are not Blade servers and it doesn't match on serial either
ahh, do they share all the same asset tag? If so, then try to switch of the asset tag syncing in the config and remove the asset tag from the device in NetBox.
Pardon, I have expressed myself incorrectly. I meant "site" instead of "location". The site is same for all 3 hosts. What does this line mean:
2022-04-25 10:10:15,476 - DEBUG2: Found a matching device object: esx6.marand.si (Posta)
These are quite big machines. I don't think they are blades. And each has its unique serial number.
Yes, the Asset Tag has value "System Asset Tag" for all 3 hosts. Do I just clear the field and save before re-syncing with changed config?
Almost, these are the two relevant lines:
2022-04-25 10:10:15,476 - DEBUG2: No match found. Trying to find device based on asset tag
2022-04-25 10:10:15,476 - DEBUG2: Found a matching device object: esx6.marand.si (Posta)
false
:
https://github.com/bb-Ricardo/netbox-sync/blob/d0143119de99fd40e39e923fe111045a85796b96/settings-example.ini#L190-L191It worked. I now have 3 devices.
Thank you very much. DEBUG2 is very useful. I'll use it from now on...
An asset Tag is meant to be unique, like a serial number. Not sure who (VMWare or Fujitsu) causes this problem here. If you can live without the tag automatically synced then you're ready to go.
Hi, I'm very pleased that this tool exists and I'm using it to synchronize virtual machines of my VMWare cluster with NetBox. Besides VirtualMachine objects, I noticed an object of type Device which holds a name of one of 3 physical machines that form the VMWare cluster. I noticed that whenever I run the synchronization, netbox-sync tries to "squeeze" the data of 3 machines into one entry of type Device, overwriting what it had just written:
It looks like the "key" of that Device object is the same for all 3 machines. Can I do something to my VMWare cluster so that I get 3 separate Device objects in NetBox?