Share

Get Orchestrator Hostname and IP using JavaScript

by Mayank Goyal · 2 May 2025

To get the vRealize Orchestrator (vRO) appliance’s hostname using JavaScript within a vRO workflow, there is no official API call for this purpose, but there are practical workarounds:

Method 1: Parse Environment Variables

In vRO 8.x (containerized), you might be able to extract the hostname from JVM arguments in the environment:

Prerequisite: Enable local process execution.

JavaScript
var com = new Command(["printenv", "|", "fgrep", "JVM_OPTS"]);
var res = com.execute(true); // makes the call blocking
var output = com.output;
var nodeName = output.match(/-Dvco.app.hostname=([^\s]+)/)[1];
System.log('vRO Hostname: ' + nodeName); // vRO Hostname: vra_fqdn.domain.local

Method 2: Extract embedded vRO Hostname from vRA Plugin

If local command execution is not permitted, you can try to extract the hostname or IP from the vRA Plugin class :

JavaScript
System.log(VraHostManager.defaultHostData.vraHost); // https://vra_fqdn.domain.local

Getting IP from FQDN

JavaScript
System.log(System.resolveHostName("vra_fqdn.domain.local")); // 10.242.1.8
System.log(System.resolveIpAddress("10.242.1.8")); //10-242-1-8.kubernetes.default.svc.cluster.local

Summary Table

MethodReliabilityNotes
CommandHighNeeds local process enabled
vRA PluginLowMay return IP or hostname

Choose the method that matches your vRO configuration and security policy.
If you cannot enable local process execution, the vRA host url extraction is the safest alternative.

Citations:

  1. https://community.broadcom.com/vmware-cloud-foundation/discussion/getting-hostnameip-of-current-node-in-vro-cluster-using-a-workflow
  2. https://richdowling.wordpress.com/2020/09/14/vrealize-orchestrator-name-ip-lookups/


Discover more from Cloud Blogger

Subscribe to get the latest posts sent to your email.

You may also like