3

I've created new VM with docker container. This VM uses Google Container-Optimized OS. How can I monitor memory usage of this instance?

There is no memory usage in observability: enter image description here

I see following message in Monitoring: Monitoring

1 Answers1

2

You can enable monitoring when you create an instance:

gcloud compute instances create instance-name \
    --image-family cos-stable \
    --image-project cos-cloud \
    --metadata=google-monitoring-enabled=true

You can also enable monitoring on an existing instance:

gcloud compute instances add-metadata instance-name \
    --metadata=google-monitoring-enabled=true
John Hanley
  • 74,467
  • 6
  • 95
  • 159
  • 1
    Thanks. Now I see compute metrics in Monitoring Metrics Explorer. List of metrics: https://cloud.google.com/monitoring/api/metrics_gcp#gcp-compute –  Nov 05 '21 at 08:07
  • Just as a comment: You still won't be able to see memory metrics on the Compute Engine dashboard, you will need to go to the Monitoring Metrics Explorer as Ilya mentioned. – josue.0 Jan 30 '22 at 19:44
  • 1
    @josue.0 this solution is not working for me, Enabled `google-monitoring-enabled` is not working for me. Still **Not Applicable** in monitoring dashboard and not able to monitor memory or other usage of my container. I create a detail thread please check it [Monitor COS](https://stackoverflow.com/questions/72836884/gcp-cloud-monitoring-for-container-optimized-os) – Azeem Haider Jul 20 '22 at 06:07