1

I have a monitor that is running on all guests, Windows and Linux. I'd like to send back the Parent host of the guest with this monitor, How can I found out the VM host from within a ESXi VM?

Ideally I'm looking for a universal way to do this from both Windows and Linux, but if they are separate paths that okay. Using something from VMWare tools would be fine, but I'm not currently using anything running the vSphere API.

MDMoore313
  • 5,531
  • 6
  • 34
  • 73
Kyle Brandt
  • 82,107
  • 71
  • 302
  • 444
  • Echoing Ed's question - what is the actual problem that you're trying to solve? – mfinni Jun 11 '14 at 15:07
  • This is for monitoring. I'd like to tag every VM with its *Current* VM Host. So I want an option where this is updated at runtime and not hardcoded into the VMs config. It doesn't have to be instance, could be something refreshed every X minutes – Kyle Brandt Jun 11 '14 at 15:09
  • 2
    When I see people ask this type of question, I think it's fair to ask about your end goal. What do you wish to accomplish with this information? The solution hinges a bit on whether this is a real cluster, whether DRS is in the picture, where you're querying from, etc. Can you fill in some of those details? Personally, I'd be using vCenter or it's API for this. – ewwhite Jun 11 '14 at 15:04
  • 3
    So, why would you be gathering this info from within the guest, rather than getting the info from VSphere? Still echoing Ed :-) – mfinni Jun 11 '14 at 15:11
  • @mfinni: Because we have monitoring agents on every Windows / Linux host pushing to the monitoring system, and currently don't have anything using the vSphere API as of yet. So this is likely more convient as thing currently stand. – Kyle Brandt Jun 11 '14 at 15:12
  • 3
    VCenter API. Extract VM location from your vCenter on demand. It's totally scriptable. I'd add it to my answer... But. – ewwhite Jun 11 '14 at 15:12
  • 4
    @KyleBrandt Your question as posted is short on details that would indicate what research has been done, what methods you've already tried that didn't work, or any troubleshooting steps. Frankly, if this were coming from a low-rep account, I think it would already have a close vote or two. – Magellan Jun 11 '14 at 15:55
  • 1
    Seriously? Closing this as off topic, even though this question is actually already answered elsewhere on the site? I think some of you are taking these close reasons way too liberally. – Mark Henderson Jun 12 '14 at 01:44
  • 1
    @Magellan - uhh if this was posted from anyone else I think it would have been totally fine. I suspect that some of your are piling onto this specifically because of who asked it. This question is totally fine as far as I can see. – Mark Henderson Jun 12 '14 at 01:49

1 Answers1

6

It seems like, out of the box, you cannot. You can however set a custom variable in VSphere to start tracking this info, and then query it using the vmtools in the guest.

http://www.virtuallyghetto.com/2011/01/how-to-extract-host-information-from.html

mfinni
  • 35,711
  • 3
  • 50
  • 86