VMware {code} Community
AndyWeigl
Contributor
Contributor

Get ESXi host details with VMware vSphere Automation SDK for Python

I wrote a script that lists all hosts that are connected to a vCenter. I can even filter hosts within a cluster.

vsphere_client = create_vsphere_client(server=server, username=user,
┆ password=password, session=session)

if args.cluster:
cl_names = set([args.cluster])

host_list = vsphere_client.vcenter.Host.list(
┆ ┆ Host.FilterSpec(clusters=cl_names))
else:
host_list = vsphere_client.vcenter.Host.list()

for host in host_list:
print(host)

This works nicely. How do I now get details about each host. e.g. IP address, HBA WWNs, CPU, memory ...

Reply
0 Kudos
2 Replies
nitreddy
Contributor
Contributor

The WWPN information is available through 

host.config.storageDevice.hostBusAdapter[x].portWorldWideName - replace x with respective adapter numbering.
Reply
0 Kudos
DavidPasqua
Contributor
Contributor

did you found a way to get those details?

having same issue here, need to get cpu, mem, etc, etc

Reply
0 Kudos