Get hands-on experience with 20+ free Google Cloud products and $300 in free credit for new customers.

How to create ops-agents policy that will install ops-agent on all Ubuntu 22.04 VMs?

I have created this ops-agent policy to install ops-agent on all my running Ubuntu 22.04 VMs, but the policy exists in the Cloud console when I navigate to Monitoring -> Dashboards -> VM instances, it shows that it's Legacy agent is installed (image below) and the agent seems uninstalled, what I'm missing here? what is the best way to install the ops agent automatically in any created VM managed by Instance Group?

 

 

gcloud beta compute instances ops-agents policies describe ops-agents-stag-policy --project=PROJECT-NAME
agent_rules:
- enable_autoupgrade: true
  package_state: installed
  type: ops-agent
  version: 2.*.*
assignment:
  group_labels:
  - env: PROJECT-NAME
    product: programs
  instances: []
  os_types:
  - short_name: ubuntu
    version: '22.04'
  zones:
  - europe-west1-b
create_time: '2024-02-14T13:23:07.226508Z'
description: A stag policy for programs.
etag: 0000000000000-ae63-468c-997f-0000000000000
id: projects/0000000000000/guestPolicies/ops-agents-stag-policy
update_time: '2024-02-14T13:23:07.226508Z'

 

 


Screenshot 2024-02-18 at 10.20.35 am.png

 

1 5 1,412
5 REPLIES 5

I want to use project level police, which is the opposite of what that question is looking for.

This looks like a startup script and not a fleet policy.