DEV Community

Ernesto Lopez
Ernesto Lopez

Posted on

Enable OS Management Service Agent on OCI Instances

The Oracle Cloud Infrastructure OS Management service allows you to manage and monitor updates and patches for the operating system environments on your Oracle Cloud instances, including instances managed by the OS ManagementOracle Autonomous Linux service. OS Management also provides options for discovering and monitoring resources on your instances.

This agent is not enabled by default during instance creation, and some pre-requisites needs to be in place:

1.-Create a dynamic group that will be used select all the instances from a compartment

A dynamic group is basically the same as a user group for instances as the principal, it is used to assign permissions to an instances so it can make API calls to OCI Resources, similar to a Instance profile on AWS

Note: for testing there is one created for Sandbox compartment

The name of the Dynamic group is> OSManagementAgent


2.-For an instance to be registered with the OS Management service, you must create policies that allow instances to use OS Management.
First of all you will need to create a policy to enable permission for the tenancy.


3. Add a policy inside the Compartment to enable the dynamic group from step 1 to access OS management features

For this example, we use the Sandbox compartment :

4. NETWORKING Requirement: you need that your VCN has access to the Service VCN
In this case you need an entry inside the routing table similar to this
adding entry on routing table

More information on service gateway HERE

This are the main requirements, now we can proceed with instance creation or agent configuration.

Enable Cloud OS Management Agent

1.-Click on show advanced options
2.-Select both agent OS Management Service Agent and Management Agent

if The pre-requisites are in place you should see the agent running

If the agent is not running, or the instance was creating without enabling the os management service agent

you will see something like this on the OS Management

Burger Menu (Up and left) >> Compute >> Instances >> Instance details >> OS Management


In this case, you need to follow the documentation for installing the agent

Getting Started with OS Management
But basically the steps are as follow:

#determine if oracle linux agent is installed
sudo yum info oracle-cloud-agent
$if not
sudo yum install -y oracle-cloud-agent
Enter fullscreen mode Exit fullscreen mode

Note For Oracle Linux 8 instances that were launched before October 2021 (running Oracle Cloud Agent 1.15.0 or earlier), the OS Management Service Agent plugin is disabled by default. The OS Management Service Agent plugin for disabled Oracle Linux 8 instances remain disabled after being updated to Oracle Cloud Agent 1.16.0. in this case you will need to follow the following tutorial:

You can also follow this video from Oracle Learning:
Getting Started with OS Management for Linux on Oracle Cloud Infrastructure

OS Management agent verification

After the correct configuration you will need to restart the agent and verify the correct configuration:

Connect to your Instance using ssh

run the following command to restart the agent

[opc@TEST-instance-ernestol ~]$ sudo systemctl restart oracle-cloud-agent.service
[opc@TEST-instance-ernestol ~]$ sudo status restart oracle-cloud-agent.service
Enter fullscreen mode Exit fullscreen mode

Run the following commands to verify that the agent are installed and running

[opc@TEST-instance-ernestol ~]$ rpm -q oracle-cloud-agent

[opc@TEST-instance-ernestol ~]$ systemctl is-enabled oracle-cloud-agent && systemctl is-active oracle-cloud-agent
Enter fullscreen mode Exit fullscreen mode

if everything seems correct you will see the following under the OS Management section in the instance detail


Discussion (0)