Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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?

share|improve this question
1  
did you search for this answer here? it gets asked once a week –  Chopper3 Jun 14 '10 at 19:57
2  
@Chopper3 Can you point me to some of those? And what search terms/methods you used to find them? I've searched for similar questions and haven't been able to find anything. Thanks. –  Jed Daniels Jun 14 '10 at 20:45
    
are you asking how to do it within the guest OS? It'd be easier to query all the ESX hosts looking for the VM... –  JakeRobinson Aug 4 '10 at 5:28
add comment

2 Answers 2

up vote 5 down vote accepted

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:

vmware-cmd  /vmfs/volumes/4aa95d52-c297af51-90e2-003048d9586a/William-XP/William-XP.vmx setguestinfo machine.id $(hostname)

If you aren't sure what the location of the VM is, you can find it with

vmware-cmd -l

*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):

vmware-guestd --cmd "info-get guestinfo.machine.id"

I know. It sucks that you can't just do something like `vmware-guestd --cmd "info-get host"', but maybe someday.

share|improve this answer
add comment

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.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.