Is it possible to query the CPU usage of a compute instance using the gcloud api?

When testing load on one main compute instance, I noticed that the top figure shows only 10% CPU usage. However, in the compute console, instance usage was 100%. I believe top shows the use of that host, while the compute console shows the use of the container. Since the container is more appropriate for my load testing, I was wondering if this metric can be queried using the api command?

$ gcloud compute cpu-utilization "instance-name". 

      

Something like that.

+3


source to share


2 answers


You can enable the Google Cloud Monitoring API for your project and query the API processor metric for your instances.



More information on the Cloud Monitoring API can be found at this link . Hope it helps.

+3


source


If you're looking for a dashboard view rather than an API to work with, you can try Google Cloud Monitoring with the agent enabled. Have you looked at this yet?



https://cloud.google.com/monitoring/agent/install-agent

+1


source







All Articles