0

I'm trying to get the IP of the hostsystems managed by our vCenter. the host.getName() only returns the DNS name of the host. What might be a way to get the IP address that you get when you ping the given host name?

  • could you be more specific about the code you used? (viijava property). Have you checked [HostIpConfig](http://vijava.sourceforge.net/vSphereAPIDoc/ver51/ReferenceGuide/) values ? – Dmitry S Oct 29 '15 at 23:58

2 Answers2

1

For those who still havig this issue, you can get the host public ip using vijava, in this way :

String hostIp = host.getConfig().getNetwork().getVnic()[0].getSpec().getIp().getIpAddress();

vijava 5.1

sahaninoo
  • 51
  • 8
0

Try something like:

host.getConfig().getNetwork().getVnic().spec.getIp().getIpAddress()

I've used something like this earlier and it worked.

darkstar
  • 157
  • 9