VMware {code} Community
sewatkins
Contributor
Contributor

Finding out the host (blade) that a VM is running on

As the title says, I'm trying to find out using the perl api, what host a particular vm is running on.

Im building a script with perl and cgi that will allow automated statistics collection for an experiment at work. Our analysts want to know the blade load during the testing, and I would like to be able to dynamically determine that during the run time of the script, as opposed to collecting all data on all blades statically.

Tags (3)
Reply
0 Kudos
2 Replies
lamw
Community Manager
Community Manager

Assuming you now how to retrieve the VM moref, under config there is a host property http://www.vmware.com/support/developer/vc-sdk/visdk41pubs/ApiReference/vim.vm.RuntimeInfo.html which points back to HostSystem moref in which you can dereive the particular ESX or ESXi host in question including it's displayname and/or hostname.

=========================================================================

William Lam

VMware vExpert 2009,2010

VMware VCP3,4

VMware VCAP4-DCA

VMware scripts and resources at:

Twitter: @lamw

Getting Started with the vMA (tips/tricks)

Getting Started with the vSphere SDK for Perl

VMware Code Central - Scripts/Sample code for Developers and Administrators

VMware Developer Community

If you find this information useful, please award points for "correct" or "helpful".

sewatkins
Contributor
Contributor

Im still learning how to work through all of this. As of late, I've just been modifying scripts with my knowledge of perl. I've just gotten into really learning the API. What do you mean by retrieving the VM moref? Is it a method I should call?

Thanks

Reply
0 Kudos