Reputation: 65
I am currently trying to get percentage of cpu used by a VM instance using the following api in GCP: https://monitoring.googleapis.com/v3/projects//metricDescriptors?filter=metric.type="compute.googleapis.com/instance/cpu/utilization"
I have also enable the monitoring services, and have performed all the required authentications.
The api seems to be working but I am getting dummy data as response, I want to get real values of resource used, do I have to activate some metric which I don't know about? Any help will be appreciated .
Following is the response which I am getting from the api call:
The respone from the above api call
Upvotes: 0
Views: 45
Reputation: 9810
The response you received isn't dummy data but a description of the metrics. This is because you hit the metricDescriptors
endpoints. Its usage is described in the doc here.
To get the actual data for a given metric, you need to hit the timeSeries
endpoint and provide the necessary filters. You can see the doc here about reading metric data. You can also test it via the API Explorer here.
Upvotes: 1