wxt9861 / esxi_stats

ESXi component for Home Assistant
MIT License
145 stars 40 forks source link

Retrying setup: None #83

Open clutch70 opened 1 year ago

clutch70 commented 1 year ago

Describe the bug Attempting to set up the integration, confirmed login details

To Reproduce Steps to reproduce the behavior: Add integration > enter details host: vcenter.my.net port: 443 tried user: my\hass and hass@my.net

Screenshots image

ESXi environment (please complete the following information):

Additional context enabled debug logging and got the following

2023-04-05 15:17:32.839 INFO (MainThread) [homeassistant.setup] Setting up esxi_stats 2023-04-05 15:17:32.840 INFO (MainThread) [homeassistant.setup] Setup of domain esxi_stats took 0.0 seconds 2023-04-05 15:17:33.671 ERROR (SyncWorker_2) [custom_components.esxi_stats] 'NoneType' object has no attribute 'committed' 2023-04-05 15:17:33.679 WARNING (MainThread) [homeassistant.config_entries] Config entry 'vcenter.my.net' for esxi_stats integration not ready yet: None; Retrying in background

clutch70 commented 1 year ago

Packet capture is available, lots of traffic between the two something like ~4k packets per attempt. Not showing any drops between HASS and vCenter. Would be happy to provide the pcap privately.

wxt9861 commented 1 year ago

Don't think we need pcap yet, but can you enable debug for the component and provide that?

clutch70 commented 1 year ago

The logs I got are after adding

logger:
  default: info
  logs:
    custom_components.esxi_stats: debug

to my configuration.yaml, I then copied out of settings > system > logs, is there somewhere else I can look?

wxt9861 commented 1 year ago

That should do it, but it should've captured debug info - there should be a lot of debug at startup outputting connection info, license info, etc... I would expect some of it to be captured before the error about "committed" is displayed.

The error is likely referencing committed vm space usage and to get that far in the process would definitely output other information.

Also - which version of the component are you using? And is this a fresh install of esxi_stats or an existing install which started giving you this error?

clutch70 commented 1 year ago

Running 0.6.4, fresh installation just discovered the component today.

Worth noting that the VM it seems to be failing on is kind of boinked. I can unregister as a troubleshooting step if that's helpful.

removing the default: info line got me the logs below.

2023-04-05 20:44:05.034 INFO (MainThread) [homeassistant.setup] Setting up esxi_stats
2023-04-05 20:44:05.035 INFO (MainThread) [homeassistant.setup] Setup of domain esxi_stats took 0.0 seconds
2023-04-05 20:44:05.233 DEBUG (MainThread) [custom_components.esxi_stats] Setting up host vcenter.my.net
2023-04-05 20:44:05.503 DEBUG (SyncWorker_10) [custom_components.esxi_stats.esxi] Logged in - session 52ad2ce1-ebf7-761f-93c2-eba1dd1e8718
2023-04-05 20:44:05.510 DEBUG (SyncWorker_10) [custom_components.esxi_stats] Product Line: vpx
2023-04-05 20:44:05.532 DEBUG (SyncWorker_10) [custom_components.esxi_stats.esxi] Checking license type
2023-04-05 20:44:05.548 DEBUG (SyncWorker_10) [custom_components.esxi_stats.esxi] Found VMware ESX Server license
2023-04-05 20:44:05.549 DEBUG (SyncWorker_10) [custom_components.esxi_stats.esxi] vSphere API feature enabled
2023-04-05 20:44:05.668 DEBUG (SyncWorker_10) [custom_components.esxi_stats.esxi] Logged in - session 524f3753-148c-5c8d-b2bb-6835d9c416a4
2023-04-05 20:44:05.678 DEBUG (SyncWorker_10) [custom_components.esxi_stats] Found 2 host(s)
2023-04-05 20:44:05.701 DEBUG (SyncWorker_10) [custom_components.esxi_stats] Getting stats for vmhost: cnhqesx00.my.net
2023-04-05 20:44:05.727 DEBUG (SyncWorker_10) [custom_components.esxi_stats.esxi] vmhost: cnhqesx00.my.net state is poweredOn
2023-04-05 20:44:05.731 DEBUG (SyncWorker_10) [custom_components.esxi_stats.esxi] {'name': 'cnhqesx00.my.net', 'state': 'poweredOn', 'version': '7.0.3', 'build': '19482537', 'uptime_hours': 76.2, 'cputotal_ghz': 41.6, 'cpuusage_ghz': 0.7, 'memtotal_gb': 127.96, 'memusage_gb': 40.31, 'maintenance_mode': False, 'vms': 11}
2023-04-05 20:44:05.759 DEBUG (SyncWorker_10) [custom_components.esxi_stats] Getting stats for vmhost: cnhqesx02.my.net
2023-04-05 20:44:05.781 DEBUG (SyncWorker_10) [custom_components.esxi_stats.esxi] vmhost: cnhqesx02.my.net state is poweredOn
2023-04-05 20:44:05.783 DEBUG (SyncWorker_10) [custom_components.esxi_stats.esxi] {'name': 'cnhqesx02.my.net', 'state': 'poweredOn', 'version': '7.0.3', 'build': '19482537', 'uptime_hours': 62.5, 'cputotal_ghz': 43.2, 'cpuusage_ghz': 7.9, 'memtotal_gb': 127.9, 'memusage_gb': 27.33, 'maintenance_mode': False, 'vms': 6}
2023-04-05 20:44:05.794 DEBUG (SyncWorker_10) [custom_components.esxi_stats] Found 4 datastore(s)
2023-04-05 20:44:05.799 DEBUG (SyncWorker_10) [custom_components.esxi_stats] Getting stats for datastore: esx00-shelf
2023-04-05 20:44:05.810 DEBUG (SyncWorker_10) [custom_components.esxi_stats.esxi] {'name': 'esx00-shelf', 'type': 'vmfs', 'free_space_gb': 7989.68, 'total_space_gb': 13278.75, 'connected_hosts': 1, 'virtual_machines': 9}
2023-04-05 20:44:05.812 DEBUG (SyncWorker_10) [custom_components.esxi_stats] Getting stats for datastore: sata0
2023-04-05 20:44:05.819 DEBUG (SyncWorker_10) [custom_components.esxi_stats.esxi] {'name': 'sata0', 'type': 'nfs', 'free_space_gb': 10698.22, 'total_space_gb': 13383.83, 'connected_hosts': 2, 'virtual_machines': 3}
2023-04-05 20:44:05.825 DEBUG (SyncWorker_10) [custom_components.esxi_stats] Getting stats for datastore: nfs-nas00-part0
2023-04-05 20:44:05.838 DEBUG (SyncWorker_10) [custom_components.esxi_stats.esxi] {'name': 'nfs-nas00-part0', 'type': 'nfs', 'free_space_gb': 7793.73, 'total_space_gb': 11071.55, 'connected_hosts': 2, 'virtual_machines': 3}
2023-04-05 20:44:05.848 DEBUG (SyncWorker_10) [custom_components.esxi_stats] Getting stats for datastore: xsr00-sas0
2023-04-05 20:44:05.879 DEBUG (SyncWorker_10) [custom_components.esxi_stats.esxi] {'name': 'xsr00-sas0', 'type': 'nfs', 'free_space_gb': 892.04, 'total_space_gb': 1087.98, 'connected_hosts': 2, 'virtual_machines': 1}
2023-04-05 20:44:05.898 DEBUG (SyncWorker_10) [custom_components.esxi_stats] Found 4 license(s)
2023-04-05 20:44:05.922 DEBUG (SyncWorker_10) [custom_components.esxi_stats] Getting stats for licenses
2023-04-05 20:44:05.922 DEBUG (SyncWorker_10) [custom_components.esxi_stats.esxi] {'name': 'Product Evaluation', 'status': 'Ok', 'product': 'n/a', 'expiration_days': 'n/a', 'host': 'vcenter.my.net'}
2023-04-05 20:44:05.922 DEBUG (SyncWorker_10) [custom_components.esxi_stats] Getting stats for licenses
2023-04-05 20:44:05.922 DEBUG (SyncWorker_10) [custom_components.esxi_stats.esxi] {'name': 'vSphere 7 Enterprise Plus', 'status': 'Ok', 'product': 'VMware ESX Server', 'expiration_days': 85, 'host': 'vcenter.my.net'}
2023-04-05 20:44:05.922 DEBUG (SyncWorker_10) [custom_components.esxi_stats] Getting stats for licenses
2023-04-05 20:44:05.922 DEBUG (SyncWorker_10) [custom_components.esxi_stats.esxi] {'name': 'VMware vSphere with Operations Management 6 Enterprise Plus', 'status': 'Ok', 'product': 'VMware ESX Server', 'expiration_days': 'n/a', 'host': 'vcenter.my.net'}
2023-04-05 20:44:05.922 DEBUG (SyncWorker_10) [custom_components.esxi_stats] Getting stats for licenses
2023-04-05 20:44:05.922 DEBUG (SyncWorker_10) [custom_components.esxi_stats.esxi] {'name': 'vCenter Server 7 Standard', 'status': 'Ok', 'product': 'VMware VirtualCenter Server', 'expiration_days': 85, 'host': 'vcenter.my.net'}
2023-04-05 20:44:05.946 DEBUG (SyncWorker_10) [custom_components.esxi_stats] Found 17 VM(s)
2023-04-05 20:44:05.956 DEBUG (SyncWorker_10) [custom_components.esxi_stats] Getting stats for vm: cnhqnvr00
2023-04-05 20:44:05.980 DEBUG (SyncWorker_10) [custom_components.esxi_stats.esxi] {'name': 'cnhqnvr00', 'status': 'green', 'state': 'running', 'uptime_hours': 3.9, 'cpu_count': 12, 'cpu_use_pct': 35.0, 'memory_allocated_mb': 24576, 'memory_used_mb': 24705, 'used_space_gb': 179.78, 'tools_status': 'toolsOk', 'guest_os': 'Ubuntu Linux (64-bit)', 'guest_ip': '10.10.94.3', 'snapshots': 0}
2023-04-05 20:44:05.986 DEBUG (SyncWorker_10) [custom_components.esxi_stats] Getting stats for vm: vcls-3401b288-2720-4498-be0a-fecfe1551d80
2023-04-05 20:44:06.004 DEBUG (SyncWorker_10) [custom_components.esxi_stats.esxi] {'name': 'vcls-3401b288-2720-4498-be0a-fecfe1551d80', 'status': 'gray', 'state': 'off', 'uptime_hours': 'n/a', 'cpu_count': 1, 'cpu_use_pct': 'n/a', 'memory_allocated_mb': 128, 'memory_used_mb': 'n/a', 'used_space_gb': 0.37, 'tools_status': 'toolsOk', 'guest_os': 'Other 3.x or later Linux (64-bit)', 'guest_ip': 'n/a', 'snapshots': 0}
2023-04-05 20:44:06.012 DEBUG (SyncWorker_10) [custom_components.esxi_stats] Getting stats for vm: smurf00
2023-04-05 20:44:06.039 DEBUG (SyncWorker_10) [custom_components.esxi_stats.esxi] {'name': 'smurf00', 'status': 'gray', 'state': 'off', 'uptime_hours': 'n/a', 'cpu_count': 6, 'cpu_use_pct': 'n/a', 'memory_allocated_mb': 8192, 'memory_used_mb': 'n/a', 'used_space_gb': 299.81, 'tools_status': 'toolsNotRunning', 'guest_os': 'Microsoft Windows 7 (64-bit)', 'guest_ip': 'n/a', 'snapshots': 0}
2023-04-05 20:44:06.043 DEBUG (SyncWorker_10) [custom_components.esxi_stats] Getting stats for vm: cnhqdns00
2023-04-05 20:44:06.056 DEBUG (SyncWorker_10) [custom_components.esxi_stats.esxi] {'name': 'cnhqdns00', 'status': 'gray', 'state': 'off', 'uptime_hours': 'n/a', 'cpu_count': 4, 'cpu_use_pct': 'n/a', 'memory_allocated_mb': 4096, 'memory_used_mb': 'n/a', 'used_space_gb': 39.89, 'tools_status': 'toolsNotRunning', 'guest_os': 'Microsoft Windows Server 2016 or later (64-bit)', 'guest_ip': 'n/a', 'snapshots': 0}
2023-04-05 20:44:06.059 DEBUG (SyncWorker_10) [custom_components.esxi_stats] Getting stats for vm: %2fvmfs%2fvolumes%2fa47b1cc1-435c1d54%2fvcenter_1%2fvcenter_1.vmx
2023-04-05 20:44:06.079 DEBUG (SyncWorker_10) [custom_components.esxi_stats.esxi] Logged out - session 524f3753-148c-5c8d-b2bb-6835d9c416a4
2023-04-05 20:44:06.079 ERROR (SyncWorker_10) [custom_components.esxi_stats] 'NoneType' object has no attribute 'committed'
2023-04-05 20:44:06.088 DEBUG (SyncWorker_10) [custom_components.esxi_stats.esxi] Logged out - session 52ad2ce1-ebf7-761f-93c2-eba1dd1e8718
2023-04-05 20:44:06.361 WARNING (MainThread) [homeassistant.config_entries] Config entry 'vcenter.my.net' for esxi_stats integration not ready yet: None; Retrying in background
clutch70 commented 1 year ago

Ok I got impatient lol. After cleaning up some of the inaccessible/orphaned guests I got my entities! Service calls work great too. Gonna use the component to shutdown/power up the guest running my frigate container on an MQTT message because ESXi throws the USB TPU away all the time for whatever reason.

flippin sweet. Thanks for the code!

wxt9861 commented 1 year ago

Excellent - if you don't mind, I'll re-open this issue to reference in a fix.

Component can handle absence of many other values however I was naive to assume committed storage would always be present. Will need to handle this gracefully to allow component to load in case this happens again.

clutch70 commented 1 year ago

Of course, lemme know if you want me to try and reproduce/gather anything else.

bitboss-ca commented 9 months ago

Same thing here - I had an old datastore that was orphaned in my vCenter. Removing that solved it. It would be nice if we could handle this possibility though.