Enable Management Agents on Compute Instances

When using a compute instance, you can use the Oracle Cloud Agent capabilities to enable the Management Agent plug-in.

Before proceeding, confirm you have completed the prerequisites. For details, see Perform Prerequisites for Deploying Management Agents on Compute Instances.

Enable Management Agents

Note

The Management Agent plugin on compute instances runs on the Java virtual machine (JVM). Starting March 2023, the Management Agent plugin is deployed with a Java runtime (JRE).

The Java runtime is always kept up-to-date as part of the Management Agent upgrade process in order to address newly discovered security vulnerabilities. After enabling the Management Agent plugin, it's important to run the latest version of the Management Agent plugin software by enabling automatic upgrades or manually invoking the upgrade operation periodically. For details, see Upgrade Management Agents on Compute Instances.

Enable Management Agents Using the Console

To confirm if the Management Agent plugin is enabled for an instance:
  1. Open the navigation menu and click Compute. Under Compute, click Instances.
  2. Click the instance that you're interested in.
  3. Click the Oracle Cloud Agent tab.

    The list of plugins displays.

  4. Toggle the Enabled switch for the Management Agent plugin.

For more information, see Managing Plugins Using the Console.

Enable Management Agents Using Compute API

For information about using the API, see REST APIs.

For information about SDKs, see Software Development Kits and Command Line Interface.

Use the following API operations to manage the Management Agent as an Oracle Cloud Agent plugin:
  • LaunchInstance - enables or disables plugins, or stops all plugins, when you create an instance.

  • UpdateInstance - enables or disables individual plugins, and stops or starts all plugins, for an existing instance.

The following is an extract from the Java Sample found in the LaunchInstance or UpdateInstance API operations which allows the user to enable Management Agent during Launch or Update of the compute instance respectively:
... 
    .agentConfig(LaunchInstanceAgentConfigDetails.builder()
			.isMonitoringDisabled(false)
			.isManagementDisabled(true)
			.areAllPluginsDisabled(false)
			.pluginsConfig(new ArrayList<>(Arrays.asList(InstanceAgentPluginConfigDetails.builder()
					.name("Management Agent")   
					.desiredState(InstanceAgentPluginConfigDetails.DesiredState.Enabled).build()))).build())
...

Where .name("Management Agent") indicates it's for Management Agent plugin and .desiredState(InstanceAgentPluginConfigDetails.DesiredState.Enabled).build()))).build()) indicates to enable the Management Agent.

For more information, see Managing Plugins Using the API.

Configure Oracle Cloud Agent with Management Gateway

To configure Management Gateway for a Management Agent that's enabled on a Oracle Cloud Compute instance:

  1. Update emd.properties file.
    1. Go to the emd.properties file, typically at the following location:
      /var/lib/oracle-cloud-agent/plugins/oci-managementagent/polaris/agent_inst/config/emd.properties
    2. At the end of the file, add the following 3 entries:
      GatewayServerHost=<gateway host>
      GatewayServerPort=<gateway port>
      GatewayServerCredentialTimeout=30s
  2. Next, if the Management Gateway is configured with a proxy user name and password then you must seed the Management Gateway Credentials to the Management Agent.
    1. Use the following command to view the contents of /tmp/cred.json file.
      cat /tmp/cred.json |sudo -u oracle-cloud-agent /var/lib/oracle-cloud-agent/plugins/oci-managementagent/polaris/agent_inst/bin/credential_mgmt.sh -o upsertCredentials -s Agent
    2. In the /tmp/cred.json file, replace the following values with the actual Management Agent credentials for your environment:
      • OCID using the following format: agent.ocid1.managementagent.oc1.phx.unique-id
      • example-username
      • example-password
        {"source":"agent.ocid1.managementagent.oc1.phx.unique-id",
        "name":"ManagementAgent-Proxy",
        "type":"ProxyCreds",
        "description":"Proxy Credentials",
        "properties":[
        {"name":"ProxyUser","value":"example-username"},
        {"name":"ProxyPassword","value":"example-password"}]}
  3. Enter the following command to restart the Oracle Cloud Agent:
    systemctl restart oracle-cloud-agent