After implementing autoscaling for our compute instance pool, we’re noticing that new instances created by autoscaling events don’t report metrics to OCI Monitoring. Manually created instances in the same compartment report metrics normally.
The autoscaling configuration triggers correctly and instances are created, but they show no CPU, memory, or disk metrics in the Monitoring service. The monitoring agent installation appears to be missing from the autoscaling launch configuration.
Our instance configuration includes:
cloud-init:
- package-update: true
- packages: ['oracle-cloud-agent']
We also suspect the instance principal policies might not grant the new instances permission to emit metrics. Has anyone configured monitoring for autoscaled instances? What’s the correct approach for ensuring monitoring agent installation and instance principal access in the launch configuration?
I’ve created the dynamic group with the matching rule for the compartment. When I try to apply the policy ‘Allow dynamic-group autoscale-instances to use metrics in compartment production’, I get a policy validation error. Is the verb ‘use’ correct for metrics, or should it be something else like ‘manage’ or ‘write’?
The verb for metric posting should be ‘use’ but you need to specify the resource type more precisely. For monitoring metrics, the correct policy format is ‘Allow dynamic-group to use metrics in compartment ’ combined with ‘Allow dynamic-group to read metrics in compartment ’. Some documentation suggests using ‘manage metrics’ for broader permissions, but ‘use’ should be sufficient for posting. Make sure your dynamic group matching rule is correct and that instances are actually being matched to the group after creation.
I checked the instance configuration and the Oracle Cloud Agent section wasn’t explicitly configured. I’ve now enabled the ‘Compute Instance Monitoring’ plugin in a new instance configuration. Should I also enable the ‘Compute Instance Run Command’ plugin for management purposes? And what about the IAM policy for instance principals - what’s the correct policy statement?