I would like to call GCP API call to get vCPU's total count. If all my instances use 280 vCPUs, I want to get 280 in the response.
I can get the vCPU limit via the API metrics using "/services/compute.googleapis.com/consumerQuotaMetrics/compute.googleapis.com%2Fcpus", but not the current vCPU count.
Is there a monitoring API for that purpose?
Help is appreciated. Thanks.
As
@guillaume blaquierecurrently there is no way to countvCPUusing GCP API. You can createFeature Requestvia Google Issue Tracker if you think it could be beneficial feature.As a workaround, you can use
Cloud Monitoringand use Chart a single metric type.In
Metrics Exploreryou would need to choose:Resource type:VM InstanceMetric:Reserved vCPUsAggregator:sumIt would look like below: