VMware {code} Community
click2karthick
Contributor
Contributor

How to get ESXi information from vCenter via scripts

Hello Guru's,

How do I collect all the ESXi hosts information in a cluster by doing SSH to vCenter. Basically, I want to do SSH to vCenter and get the host version, enic, fnic driver versions. I have a hard limit that my tool can use either SSH or python api's. Appreciate if anyone can point me the right set of commands.

Thanks, Karthick.

5 Replies
stumpr
Virtuoso
Virtuoso

I've used Ansible with raw commands vs ESXi (many of the core modules will not work as some of the python libs are not there).  That worked well for doing bulk operations and retrieving command results from many ESXi hosts.

The other option is to talk to the vCenter API with one of the SDKs.  Since you mentioned Python, PyVmomi would be your best bet (vmware/pyvmomi · GitHub).

You may have some gaps in information you want (need to know more specifics). But the PCI and device info is basically available for storage and network adapters.  Just have to dig and pull it out as a report that is useful for your requirements.

Reuben Stump | http://www.virtuin.com | @ReubenStump
UmeshAhuja
Commander
Commander

Hi,

Have a try with this.... very beautiful script on collecting the ESXi host information as per your requirement.

Collecting ESXi Host Hardware Information with PowerShell

Thanks n Regards
Umesh Ahuja

If your query resolved then please consider awarding points by correct or helpful marking.
click2karthick
Contributor
Contributor

Stumpr,

Thanks for the info. I managed to get the ESXi version from Pyvmomi api. Can you please tell me what is the exact class/method to get enic and fnic version? e.g vim.host.HostBusAdapter ?

Thanks, Karthick

0 Kudos
stumpr
Virtuoso
Virtuoso

What exactly do you want for version?  The firmware?  The type (VMXNET, E1000, etc)?

Reuben Stump | http://www.virtuin.com | @ReubenStump
0 Kudos
click2karthick
Contributor
Contributor

I need "enic" and "fnic" frimware version. Thanks for looking into it.

0 Kudos