VMware Cloud Community
lhoreis
Contributor
Contributor
Jump to solution

Retrieve cluster utilization metrics using vRO

Hello,

when looking at the "Summary" tab of a Cluster in vSphere Web Client there is a graph showing

  • Capacity
  • Used and
  • Free

for

  • CPU
  • Memory and
  • Storage

I would like to know how to access these values behind the graph from vRealize Orchestrator and how they are calculated!? Reason is, that I want

to use the values  for CPU and Memory for the selection of the least used cluster when deploying a new VM.

Currently I'm playing around with figures which I extracted from 

VcComputeResourceSummary()

VcClusterComputeResourceSummary()

VcResourcePoolRuntimeInfo()

and extract stuff like

  • resourcePool.runtime.cpu.unreservedForVm
  • resourcePool.runtime.memory.unreservedForVm

and also

  • resourceSummary.UsageSummary.totalCpuCapacityMhz
  • resourceSummary.UsageSummary.cpuDemandMhz

etc.

So far, I wasn't able to get any values which are close enough to the values which are shown in the vSphere Web Client.

Any input is highly appreciated. I already searched the community, but I wasn't able to find something.

Regards,

Lars

Reply
0 Kudos
1 Solution

Accepted Solutions
iiliev
VMware Employee
VMware Employee
Jump to solution

Hi Lars,

You can access these values via the property resourceUsage of the cluster scripting object. Here is some sample code (the input parameter is the variable cluster of type VC:ClusterComputeResource:disappointed_face:

var usage = cluster.resourceUsage;

System.log("CPU Used MHz: " + usage.cpuUsedMHz);

System.log("CPU Capacity MHz: " + usage.cpuCapacityMHz);

System.log("Memory Used MB: " + usage.memUsedMB);

System.log("Memory Capacity MB: " + usage.memCapacityMB);

System.log("Storage Used MB: " + usage.storageUsedMB);

System.log("Storage Capacity MB: " + usage.storageCapacityMB);

View solution in original post

Reply
0 Kudos
2 Replies
iiliev
VMware Employee
VMware Employee
Jump to solution

Hi Lars,

You can access these values via the property resourceUsage of the cluster scripting object. Here is some sample code (the input parameter is the variable cluster of type VC:ClusterComputeResource:disappointed_face:

var usage = cluster.resourceUsage;

System.log("CPU Used MHz: " + usage.cpuUsedMHz);

System.log("CPU Capacity MHz: " + usage.cpuCapacityMHz);

System.log("Memory Used MB: " + usage.memUsedMB);

System.log("Memory Capacity MB: " + usage.memCapacityMB);

System.log("Storage Used MB: " + usage.storageUsedMB);

System.log("Storage Capacity MB: " + usage.storageCapacityMB);

Reply
0 Kudos
lhoreis
Contributor
Contributor
Jump to solution

Hello Ilian,

thank you very much for your quick response. That was the way I tried it long time ago, but for some reason I discarded it. The values I retrieve now look way better.

Regards,

Lars

Reply
0 Kudos