Cloud_Automatio
Contributor
Contributor

How to get vRO IP or FQDN from running vRO node in the cluster ?

Dear experts - we have a requirement to resolve IP or FQDN from running vRO node in HA (cluster) environment - do you have any suggestions on how to go about it ? 

thanks a bunch!

Alex

0 Kudos
5 Replies
Cloud_Automatio
Contributor
Contributor

Partial solution for this (found out googling):

var netInterface = Config.getNetworkInterfaces();
System.log(netInterface.getValidBindInterfaces());
 
this gets a list of network interfaces from which IPs of local host/external are resolvable.
 
0 Kudos
iiliev
VMware Employee
VMware Employee

Try the following (retrieves the information using standard Linux commands):

var command = new Command("hostname");

var ret = command.execute(true);

if (ret == 0) {

  System.log("hostname: " + command.output.trim());

} else {

  System.log("Error -> " + ret);

}

command = new Command("hostname -f");

ret = command.execute(true);

if (ret == 0) {

  System.log("FQDN: " + command.output.trim());

} else {

  System.log("Error -> " + ret);

}

command = new Command("hostname -i");

ret = command.execute(true);

if (ret == 0) {

  System.log("IP: " + command.output.trim());

} else {

  System.log("Error -> " + ret);

}

0 Kudos
Cloud_Automatio
Contributor
Contributor

thanks for replying, the solution above though gets authorization error, one of the settings needs to be tweaked to get it to work. 

One of our developers found this solution to the problem:

// Get information about this vRO

var netInterface = Config.getNetworkInterfaces();

var thisIP = netInterface.getBindInterface();

System.log("This IP = "+thisIP);

var thisHostName = System.resolveIpAddress(thisIP);

System.log("This host name = "+thisHostName);

0 Kudos
lurims
Enthusiast
Enthusiast

Hi IIian,

I have a similar need to log the FQDN name of the vRO.  Your method needs a property needs to be added in the vRO config which is not allowed due to security restrictions. 

Neither this method suggested another person is available in vRO.

var netInterface = Config.getNetworkInterfaces();

Do you have anyother way of logging the vRO hostname in the log file?

0 Kudos
lurims
Enthusiast
Enthusiast

qc4vmware suggested a way here to get it.

0 Kudos