VMware {code} Community
ilijaaf
Contributor
Contributor

Unable to retrieve performance metric for a vm

Hello, 

I'd like to retrieve advanced performance metrics via a vmware API, but I can't figure out how (even after trying documentation and googling).

I want to get power usage data for single VMs in an ESXI Cluster. I am able to see a chart based based on this data in vSphere representing the power usage by clicking on VM > Monitor > Performance > Advanced.

I am using the System Version 7.0.3.01300

I tried the routes 

 

/rest/vcenter/vm/my-vm-id

 

which unfortunately does not contain the power usage metrics

and 

 

/api/stats/data/dp?metric=power.capacity.usage&types=VM=my-vm-id

 

trying to specify the vm id and vm type in varous combinations always receiving the error message: 

Invalid data points filter
 
Any thoughts/advice on this?

(Please excuse me if the location of the post is wrong - this is my first post in the vmware communities)

 

0 Kudos
2 Replies
GreenMotion
Contributor
Contributor

Same here! 😞

I know this feature is experimental, but I'm not able squeeze any kind of performance information out of this API and get the following error no matter what parameters I provide:

{
    "messages": [
        {
            "args": [],
            "default_message": "Invalid data points filter: found empty set of Counters for provided set of (cid,metric,types,resources)",
            "localized": "Invalid data points filter: found empty set of Counters for provided set of (cid,metric,types,resources)",
            "id": "com.vmware.vstats.data_points_invalid_counter_filter"
        }
    ]
}

 

I'm guessing it's user error due to not understanding this API call. 

If anyone could provide an example of how to invoke this API, it would be greatly appreciated.

Thank you much!

   R.

0 Kudos
doskiran
Enthusiast
Enthusiast

Looks like Create Acq Spec is not created.
vStats collects data only for the configured AcqSpecs.

Try these steps:

1. Create AcqSpecs with POST Create AcqSpec API
POST: https://{api_host}/api/stats/acq-specs
Spec:

 

{
    "counters": {
        "cid_mid": {
            "cid":"power.capacity.usage.VM"
        }
    },
    "interval" :"30",
    "expiration":"10000000000",
    "resources": [       
         {
            "type":"VM",
            "id_value":"<vm-moid>",
            "predicate":"EQUAL"
        }
    ]
}

 

2. Query Data Points Data:

GEThttps://{api_host}/api/stats/data/dp?cid=power.capacity.usage.VM&types=VM

 

 

 

0 Kudos