Is there a way to find which ESXi server a particular VM on? For instance, I am on rhel5.4 vm, with vmware-guestd daemon running. But I want to find the hostname of ESXi server on which this Vm exists?
I agree with Charles that there isn't any easy way to do this. If you are willing to change the configuration file of the VM in question on the host, you can write the hostname to it and then access it via a call from the vmware-tools (examples taken from http://communities.vmware.com/message/1479849#1479849). For example:
On the host:
If you aren't sure what the location of the VM is, you can find it with
*Note: If you are using ESXi, then you will need to install the VCLI in a linux host somewhere instead of running vmware-cmd directly on the host.
On the guest (this cmd is for a linux guest):
I know. It sucks that you can't just do something like `vmware-guestd --cmd "info-get host"', but maybe someday.
To answer your question, with ESX/ESXi there is no way to do this that I know of. I have seen other people do it via scripts, but all those scripts really do is call the VCenter and query for the host that said server name is running on. My question would be how you are setup, because if you are not running DRS/HA then you could just run BGInfo and add the host name as a line in your BGInfo config file. Assuming you are running DRS/HA this of course is not useful however.