bb-Ricardo / netbox-sync

Sync objects from VMware or redfish sources to NetBox
MIT License
286 stars 65 forks source link

WARNING: Unable to determine second key 'cluster' for virtual machine '(hidden)', got: None #398

Open felix-sterzelmaier-concat opened 4 months ago

felix-sterzelmaier-concat commented 4 months ago

Hello, for new VMs in vSphere i get these warnings when running your script: WARNING: Unable to determine second key 'cluster' for virtual machine '(hidden)', got: None

In vSphere these VMs have a valid value for Cluster. The Clustername is also present in Netbox, but the script does not link the VMs to the cluster. Am i missing something? Is it normal that the relation hast to be added manually? Or is my configuration wrong? Unfortunately there is no documentation telling me which fields are set by the script.

Thank you!

bb-Ricardo commented 4 months ago

Hi, Could you run the script in -l DEBUG2 mode and post the output for one example VM. Then we hopefully get an idea of what is going on.

felix-sterzelmaier-concat commented 4 months ago

Hello, here is the Log with DEBUG2 enabled. I truncated it and marked these lines with "[...]". Also i replaced all sensitive information.

[...]
2024-06-14 10:49:22,120 - DEBUG: Parsing vCenter VM: (hidden vm name)
2024-06-14 10:49:22,149 - DEBUG2: Ignoring offline VM '(hidden vm name)' on first run
[...]
2024-06-14 10:50:05,968 - DEBUG: Parsing vCenter VM: (hidden vm name)
2024-06-14 10:50:06,110 - DEBUG2: Found a matching vm_tenant_relation '(hidden tenant name)' (^(hidden tenant regex).*) for (hidden vm name)
2024-06-14 10:50:06,169 - DEBUG2: Parsing device VirtualE1000: (hidden mac)
2024-06-14 10:50:06,180 - DEBUG2: Trying to find a virtual machine based on the collected name, cluster, IP and MAC addresses
2024-06-14 10:50:06,300 - WARNING: Unable to determine second key 'cluster' for virtual machine '(hidden vm name)', got: None
2024-06-14 10:50:06,300 - WARNING: This could cause serious errors and lead to wrongly assigned object relations!!!
2024-06-14 10:50:06,357 - DEBUG2: No exact match found. Trying to find virtual machine based on MAC addresses
2024-06-14 10:50:06,366 - WARNING: Unable to determine second key 'cluster' for virtual machine '(hidden vm name)', got: None
2024-06-14 10:50:06,366 - WARNING: This could cause serious errors and lead to wrongly assigned object relations!!!
2024-06-14 10:50:06,366 - DEBUG2: Found matching MAC '(hidden mac)' on virtual machine '(hidden vm name) (None)'
2024-06-14 10:50:06,371 - WARNING: Unable to determine second key 'cluster' for virtual machine '(hidden vm name)', got: None
2024-06-14 10:50:06,371 - WARNING: This could cause serious errors and lead to wrongly assigned object relations!!!
2024-06-14 10:50:06,371 - DEBUG2: Found one virtual machine '(hidden vm name) (None)' based on MAC addresses and using it
2024-06-14 10:50:06,371 - WARNING: Unable to determine second key 'cluster' for virtual machine '(hidden vm name)', got: None
2024-06-14 10:50:06,372 - WARNING: This could cause serious errors and lead to wrongly assigned object relations!!!
2024-06-14 10:50:06,372 - DEBUG2: Found a matching virtual machine object: (hidden vm name) (None)
2024-06-14 10:50:06,372 - DEBUG2: Parsing 'virtual machine' data structure: (hidden vm name)
2024-06-14 10:50:06,372 - DEBUG2: Parsing 'site' data structure: FRA 1 (NTT)
2024-06-14 10:50:06,372 - DEBUG2: Parsing 'platform' data structure: FreeBSD (64-bit)
2024-06-14 10:50:06,372 - DEBUG2: Parsing 'tenant' data structure: (hidden tenant name)
2024-06-14 10:50:06,377 - DEBUG2: Parsing 'Virtual Disk' data structure: Hard disk 1
2024-06-14 10:50:06,377 - DEBUG2: Trying to match current object interfaces in NetBox with discovered interfaces
2024-06-14 10:50:06,389 - DEBUG2: Found '1' NICs in NetBox for '(hidden vm name)'
2024-06-14 10:50:06,389 - DEBUG2: Found 1:1 name match for NIC 'vNIC 1 (none)'
2024-06-14 10:50:06,390 - DEBUG2: Parsing 'virtual machine interface' data structure: vNIC 1 (none) ((hidden vm name))
2024-06-14 10:50:07,024 - DEBUG: Parsing vCenter VM: (hidden next vm name)
[...]
jhammond-git commented 3 months ago

This was happening to me, but only when the cluster being imported didn't exist in Netbox.