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).
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.
Here's another option:
cat /etc/vmware/vpxa/vpxa.cfg | grep serverIp
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.
check out below blog:
Virtual-Ware: How to Find Virtual Center IP from ESX Host
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.
>BTW, you can also get this from the API
Yeah, that would be the proper way to do this. Thanks.
cat /etc/vmware/vpxa/vpxa.cfg | grep serverIp
Yes, this works nicely, thanks. (Though you don't need 'cat'.)