如何监控运行在 GCE 上的容器虚拟机的内存使用情况?

3

我创建了一个新的虚拟机,并使用Docker容器。此虚拟机使用Google Container-Optimized OS。如何监控这个实例的内存使用情况?

在可观测性方面没有内存使用情况: enter image description here

我在监控中看到以下消息: Monitoring

1个回答

2
您可以在创建实例时启用监控功能:
gcloud compute instances create instance-name \
    --image-family cos-stable \
    --image-project cos-cloud \
    --metadata=google-monitoring-enabled=true

您可以在现有实例上启用监控:
gcloud compute instances add-metadata instance-name \
    --metadata=google-monitoring-enabled=true

1
谢谢。现在我可以在监控指标浏览器中查看计算指标。 指标列表:https://cloud.google.com/monitoring/api/metrics_gcp#gcp-compute - user13331707
仅作为评论:您仍然无法在Compute Engine仪表板上查看内存指标,您需要像Ilya提到的那样前往监视指标浏览器。 - josue.0
1
@josue.0 这个解决方案对我不起作用,启用 google-monitoring-enabled 对我也没有用。在监控仪表板中仍然显示“不适用”,无法监视容器的内存或其他使用情况。我创建了一个详细的线程,请查看 Monitor COS - Azeem Haider

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接