I want my compute engine VM to show memory usage metrics in the console, I went to this page and install Ops-Agents, restart the service and went to the VM observability section, but still saw a message that the agent is not installed (in the memory usage metric):
I thought maybe by default the memory usage is not installed (it's not mentioned anywhere, just a guess) and I need to modify the config. I went to this docs and added this code to
/etc/google-cloud-ops-agent/config.yaml
:
metrics:
receivers:
agent.googleapis.com/memory/bytes_used:
type: hostmetrics
collection_interval: 1m
According to the docs, this config will be merged with the built-in configuration when the agent restarts. I restarted the agent service, went back to the dashboard but still it shows the message "Requires Ops Agent". I don't know what I'm doing wrong, the documentations are really poor for that topic IMO, I couldn't find any example on how to turn on memory usage metrics.
EDIT
Running sudo systemctl status google-cloud-ops-agent"*"
I can see this error message:
otelopscol[2763]: 2022-05-02T14:07:02.780Z#011error#011collector@v0.26.1-0.20220307211504-dc45061a44f9/metrics.go:235#011could not export time series to GCM#011{"error": "rpc error: code = InvalidArgument desc = Name must begin with '{resource_container_type}/{resource_container_id}', got: projects/"}
EDIT2 If I click INSTALL via the console, I see this installation instructions:
:> 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
It's differente from the one here: 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
Not sure what installed what, tried both.