top of page

Pulling vSphere World Metrics from VCF Operations via API

  • Writer: Brock Peterson
    Brock Peterson
  • Aug 18
  • 2 min read

vSphere World is a powerful construct in VCF Operations, I think of it as the bucket that contains everything. For example, maybe you want to see the number of Clusters, ESXi Hosts, and VMs in your environment. Those are just metrics on the vSphere World object, like this.


ree

You can pull these metrics from the VCF Operations API surface, here's how. Go to https://vcfoperationsfqdnhere/suite-api and authenticate.


ree

There are other ways to do this, which we've discussed previously here. Once authenticated, you'll need the vSphere World ResourceId, which you can find via GET /api/resources with the ResourceKind of vSphere World. My call looks like this.


ree

Scroll down and click Execute to run it, which will give you the associated Curl command as well.


ree

The identifier is at the bottom, this is what we'll use to get the metrics we want from vSphere World, but first we need to determine the StatKeys, which I think of as the metrics themselves. Do this with GET /api/resources/statkeys and your resourceId, mine looks like this. Note: you can use the searchstring field if you know what you want, for example I might have used total here.


ree

We now have the StatKeys for the metrics we want:

  • Clusters: summary|total_number_clusters

  • ESXi Hosts: summary|total_number_hosts

  • VMs: summary|total_number_vms


Now we can get the latest values for them by using GET /api/resources/stats/latest as follows.


ree

Notice I provided the resourceId for vSphere World and the statKeys we previously captured.


ree

Click Execute and you'll be given the latest values (along with the Curl command if you wany to use that elsewhere).


ree

Now if you compare these to the latest values in the UI, they match!


ree

This same methodology can be used to pull metrics/properties against any object you want. Use the VCF Operations API, it's powerful!

    bottom of page