Saturday, June 29, 2013

ESXi/vCenter find on whitch host a VM is running

Some times we need to know on which host is running a VM.

Is always a pain to discover this when you don't have your vCenter running.
You can check the VM logs etc.,(looking for something similar to 2012-10-10T02:04:01.999Z| vmx| Hostname=name_of_host)

But for me the best option is just run a query directly in the vCenter DB.

Just run this simple query in the vCenter DB(should be VIM_VCDB, or just VCDB)

SELECT vpxv_vms.vmid, vpxv_vms.NAME, vpxv_vms.hostid, vpxv_hosts.NAME
FROM vpxv_vms
(vpxv_hosts.hostid = vpxv_vms.hostid)
AND (vpxv_vms.NAME = 'virtual_machine_name')

This will give you in a simple line the VM and the host that is running.

Hope this can help.

Luciano Patrão

Note: Check VMware KB2004187 for more details

No comments:

Post a Comment