This command only returns the ops-agent-policy, not the actual ops-agent version:
gcloud compute instances describe --zone=us-central1-a testVM1 --project myTESTproject --format="value(labels.goog-ops-agent-policy)"
Returns: v2-x86-template-1-4-0
But on testVM1 the ops-agent version is: 2.53.0
Also, it is my understanding that two different VMs can have the same ops-agent-policy but have different ops-agent version installed.
Is there a way to get ops-agent version using gcloud?
Or is there a way to find it locally on the server?
Solved! Go to Solution.
I found a way...
==== ops agent version 2.49.0 ==============
$ gcloud compute ssh --project proj-test --zone us-central1-a dev1 --command "apt list |grep -i google-cloud-ops-agent |grep -v dbgsym"
google-cloud-ops-agent/google-cloud-ops-agent-bookworm-2 2.55.0~debian12 amd64 [upgradable from: 2.49.0~debian12]
==== ops agent version 2.55.0 ==============
$ gcloud compute ssh --project proj-test --zone us-central1-a dev2 --command "apt list |grep -i google-cloud-ops-agent |grep -v dbgsym"
google-cloud-ops-agent/google-cloud-ops-agent-bookworm-all,google-cloud-ops-agent-bookworm-2,now 2.55.0~debian12 amd64 [installed]
I found a way...
==== ops agent version 2.49.0 ==============
$ gcloud compute ssh --project proj-test --zone us-central1-a dev1 --command "apt list |grep -i google-cloud-ops-agent |grep -v dbgsym"
google-cloud-ops-agent/google-cloud-ops-agent-bookworm-2 2.55.0~debian12 amd64 [upgradable from: 2.49.0~debian12]
==== ops agent version 2.55.0 ==============
$ gcloud compute ssh --project proj-test --zone us-central1-a dev2 --command "apt list |grep -i google-cloud-ops-agent |grep -v dbgsym"
google-cloud-ops-agent/google-cloud-ops-agent-bookworm-all,google-cloud-ops-agent-bookworm-2,now 2.55.0~debian12 amd64 [installed]