【发布时间】:2022-06-15 22:01:08
【问题描述】:
我希望我的计算引擎 VM 在控制台中显示内存使用指标,我去了 this page 并安装了 Ops-Agents,重新启动服务并转到 VM 可观察性部分,但仍然看到一条消息说代理是未安装(在内存使用指标中):
我想也许默认情况下没有安装内存使用(它没有在任何地方提到,只是一个猜测),我需要修改配置。我去了this docs,把这段代码加到/etc/google-cloud-ops-agent/config.yaml:
metrics:
receivers:
agent.googleapis.com/memory/bytes_used:
type: hostmetrics
collection_interval: 1m
根据文档,当代理重新启动时,此配置将与内置配置合并。 我重新启动代理服务,返回仪表板,但仍然显示消息“需要 Ops Agent”。 我不知道我做错了什么,IMO 的文档真的很差,我找不到任何关于如何打开内存使用指标的示例。
编辑
运行sudo systemctl status google-cloud-ops-agent"*"
我可以看到这个错误信息:
otelopscol[2763]: 2022-05-02T14:07:02.780Z#011error#011collector@v0.26.1-0.20220307211504-dc45061a44f9/metrics.go:235#011可以 不将时间序列导出到 GCM#011{"error": "rpc error: code = InvalidArgument desc = 名称必须以 '{resource_container_type}/{resource_container_id}',得到:projects/"}
EDIT2 如果我通过控制台单击安装,我会看到以下安装说明:
:> agents_to_install.csv && \
echo '"projects/<project>/zones/europe-west1-b/instances/<instance>","[{""type"":""ops-agent""}]"' >> agents_to_install.csv && \
curl -sSO https://dl.google.com/cloudagents/mass-provision-google-cloud-ops-agents.py && \
python3 mass-provision-google-cloud-ops-agents.py --file agents_to_install.csv
与这里的不同:https://cloud.google.com/monitoring/agent/monitoring/installation#joint-install
curl -sSO https://dl.google.com/cloudagents/add-monitoring-agent-repo.sh
sudo bash add-monitoring-agent-repo.sh --also-install
不确定安装了什么,都试过了。
【问题讨论】:
-
在您的用户配置(与内置配置合并)中,您定义了一个接收器,我不确定名称“agent.googleapis.com/memory/bytes_used”是否会导致重新启动服务时看到的错误。
标签: google-cloud-platform google-compute-engine google-cloud-ops-agent