Get hands-on experience with 20+ free Google Cloud products and $300 in free credit for new customers.

Getting current vCPUs usage with MQL

I'm using the following monitoring query to get the current maximum vCPU's utilization (how many are used).
fetch consumer_quota
| metric 'serviceruntime.googleapis.com/quota/allocation/usage'
| filter
(resource.service == 'compute.googleapis.com') && (metric.quota_metric == 'compute.googleapis.com/cpus') | group_by 60s, [value_usage : max(value.usage)]
 
It only returns a number when I increase the time value (from 60s to 24000s), and the result is not accurate.  What should I change in the query in order to get the current usage of vCPUS? i.e- right now all my instances are using 392 vCPUs.
Thanks!
0 1 270
1 REPLY 1

Hi Tavni,

I have tried the above mentioned query and it worked fine for me. I didn't have to increase the time value. However, here is documentation about the metrics that can be monitored in stackdriver.