VMware Cloud Community
fsckit
Enthusiast
Enthusiast

What vCenter Manages my Host

Is there any way, from the ESXi host, or by running a CLI command against the host, to know which vCenter Server manages the host?

Thanks.

Tags (2)
Reply
0 Kudos
8 Replies
grasshopper
Virtuoso
Virtuoso

The easiest way is to vSphere client as root to the ESXi host.  You will get a pop-up stating that the host is managed by a vCenter at IP address x.x.x.x.  Simply perform an nslookup or ping -a against that IP to get the friendly name of the vCenter.

Alternatively, from an ssh session to the ESXi host, perform the following:

cat /var/log/vmauthd.log | grep vpxuser

The above will return the VC IP similar to the following output:
vthread-3| I120: login from <x.x.x.x> as vpxuser

(Where x.x.x.x will be the IP address of your vCenter Server).

fsckit
Enthusiast
Enthusiast

Thanks. I knew about logging into the host using vSphere client, and that works well, but I need to do this in a script.

I don't have any lines containing "login" in my vmauthd log file. I do have lines for the vpxuser, but no IP addresses on that line.  I see plenty of my vCenter server's IP address, but also other IP addresses.  I think the log files may have what I need, I just need a way to reliably find the server I'm looking for.

Reply
0 Kudos
grasshopper
Virtuoso
Virtuoso

Here's another option:

cat /etc/vmware/vpxa/vpxa.cfg | grep serverIp

Reply
0 Kudos
grasshopper
Virtuoso
Virtuoso

BTW, you can also get this from the API.  For example, here's an old PowerCLI script that's uses QueryHostConnectionInfo, which is still valid on the current HostConnectInfo object in 5.5. 

vickey0rana
Enthusiast
Enthusiast

check out below blog:

Virtual-Ware: How to Find Virtual Center IP from ESX Host

---------------------------------------------------------------- If you found this or any other answer helpful, please consider to award points. (use Correct or Helpful buttons) BR, Ravinder S Rana
Reply
0 Kudos
fsckit
Enthusiast
Enthusiast

Thanks. Does not work for me though. My current vpxa log (on any of the hosts in this cluster) has no "Manager IP" string, nor the IP address of my vCenter Server. 

Reply
0 Kudos
fsckit
Enthusiast
Enthusiast

>BTW, you can also get this from the API

Yeah, that would be the proper way to do this. Thanks.

Reply
0 Kudos
fsckit
Enthusiast
Enthusiast

cat /etc/vmware/vpxa/vpxa.cfg | grep serverIp

Yes, this works nicely, thanks. (Though you don't need 'cat'.)

Reply
0 Kudos