VMware Cloud Community
Naineyess
Enthusiast
Enthusiast

Cluster details ?

Hi,

I am creating a workflow to get VM related details like the available capacity(CPU,RAM) of the cluster of that VM (input is VM) .

Please help me to get a proper details.

Thanks !!

0 Kudos
1 Reply
iiliev
VMware Employee
VMware Employee

Something like this should work (vm is the input virtual machine parameter)

var cluster = vm.runtime.host.parent;

if (cluster.vimType == "ClusterComputeResource") {

  System.log("cluster name -> " + cluster.name);

  System.log("cpu cores -> " + cluster.summary.numCpuCores);

  System.log("effective cpu (MHz) -> " + cluster.summary.effectiveCpu);

  System.log("effective mem (MB) -> " + cluster.summary.effectiveMemory);

  System.log("total cpu (MHz) -> " + cluster.summary.totalCpu);

  System.log("total mem (Bytes) -> " + cluster.summary.totalMemory);

  // usage details for a DRS cluster can be accessed via cluster.usageSummary;

} else {

  System.log("Not a cluster, perhaps a standalone host? -> " + cluster.vimType);

}

0 Kudos