GCP ops-agent policies for monitor and logg - error while running gcloud

499 Views Asked by At

I need your assistance for the below.

gcloud beta compute instances ops-agents policies create ops-agents-policy-for-ubuntu --agent-rules="type=logging,version=current-major,package-state=installed,enable-autoupgrade=true;type=metrics,version=current-major,package-state=installed,enable-autoupgrade=true" --os-types=short-name=ubuntu,version=16.04 --group-labels=env=test

while running the above gcloud command for ops-agent policy, its throwing below error.

WARNING: For the policies to take effect on [ubuntu] OS distro, please follow the instructions at https://cloud.google.com/compute/docs/manage-os#agent-install to install the OS Config Agent on your instances.
ERROR: (gcloud.beta.compute.instances.ops-agents.policies.create) INVALID_ARGUMENT: Conflict - Policy 'projects/xxxxxx/guestPolicies/agent-install-policy' targets the same configs and instances.

Also, checked if there is any policy running already.

gcloud beta compute instances ops-agents policies list
Listed 0 items.

but it works in other project and I don't know why.

Is it because of any IAM Permission needed to run?

1

There are 1 best solutions below

0
On

Could it be that you have same values twice in the same command? or maybe it was a typo on your side?

below parameters can be seen twice in the command

version=current-major,package-state=installed,enable-autoupgrade=true