Not able to find the current working node in vRA 3 node architecture, we were easily able to find the current working using "localhost" command till vRO 7.6 to connect with the vRA appliance and fetch the vRO workflow token runs logs.
This can be done like this:
var command = new Command("printenv");
command.execute(true);
var out = command.output;
var prop = "-Dvco.app.hostname=";
var posStart = out.indexOf(prop);
var posSpace = out.indexOf(" ", posStart);
var vROHostname = out.substring(posStart + prop.length, posSpace);
Thanks Jeff_CH.
The code is returning VIP as a output, as we have 3 node behind VIP.
The requirement is to find out the current node on which the workflow execution logs are present.
We want current node as a output because then only we can take workflow logs of the current workflow token execution.
Please let me know if any clarification required from my end.
Regards
Charu Ganga
Hi Charu,
I can't test that setup with me, but following shows the complete string which also includes the local vRO IP (also shown in the output), you'll need to resolve that IP to the hostname then:
var command = new Command("printenv");
command.execute(true);
var out = command.output;
var prop = "JAVA_PROXY_NON_PROXY=";
var posStart = out.indexOf(prop);
var posSpace = out.indexOf("LANG=", posStart);
var tempSubstring = out.substring(posStart + prop.length, posSpace);
System.log("Complete string : " + tempSubstring);
var vROHostIP = tempSubstring.split("|")[8];
System.log("vRO-Node IP : " + vROHostIP);
Hope this works for you.
Thank you...
This didn't fit for us, as the appliances are behind the Load Balancer.
We are now using "Configuration element" to check logs on all the three nodes.