VMware Cloud Community
NehaShah
Contributor
Contributor

What is the right SDK?

Hello,

I want to collect inventory data of hosts, virtual machines, cluster, datastore, resourcepool and also performance data of hosts and virtual machines using python. Can someone please advice which will be the right python SDK to use and where can I get it from?

Thanks

2 Replies
vThinkBeyondVM
VMware Employee
VMware Employee

I would suggest to use pymomi vSphere management SDK: https://github.com/vmware/pyvmomi

To get samples: You can refer All Samples - Samples - VMware Developer Center  (select python as language).


----------------------------------------------------------------
Thanks & Regards
Vikas, VCP70, MCTS on AD, SCJP6.0, VCF, vSphere with Tanzu specialist.
https://vThinkBeyondVM.com/about
-----------------------------------------------------------------
Disclaimer: Any views or opinions expressed here are strictly my own. I am solely responsible for all content published here. Content published here is not read, reviewed or approved in advance by VMware and does not necessarily represent or reflect the views or opinions of VMware.

NehaShah
Contributor
Contributor

Thanks for the reply. I have one more question regarding this SDK.

To create a connection we use pyvmomi.connect.SmartConnect which returns a service instance object. I can find a VM by instance uuid using function serviceinstance.content.searchIndex.FindByUuid(). But if there is a new VM added from Vcenter sometime after creating service instance object, will it be searchable using the same service instance object using FindByUuid() function or do I have to refresh the connection in some way and get new service instance object to be able to get this new VM?

0 Kudos