Enabling Monitoring for Compute Instances

This topic describes how to enable monitoring, specifically for the compute instance metrics, on compute instances.

The compute instance metrics provide data about the activity level and throughput of the instance. These metrics are required to use features such as autoscaling, metrics, alarms, and notifications with compute instances. A compute instance emits these metrics only when the Compute Instance Monitoring plugin is enabled and running on the instance.

The Compute Instance Monitoring plugin is managed by the Oracle Cloud Agent software.

Note

To monitor certain metrics without the use of Oracle Cloud Agent, use Agentless Compute Metrics.

Supported Images

Compute instance metrics are supported on current platform images and on custom images that are based on current platform images.

If you use an older platform image, you must manually install the Oracle Cloud Agent software before you can use the Compute Instance Monitoring plugin. Select an image dated after November 15, 2018 (except Ubuntu, which must be dated after February 28, 2019).

You might have success enabling compute instance metrics on other images that support the Oracle Cloud Agent software, though the Compute Instance Monitoring plugin has not been tested on other operating systems and there is no guarantee that it will work.

Required IAM Policy

To use Oracle Cloud Infrastructure, an administrator must be a member of a group granted security access in a policy  by a tenancy administrator. This access is required whether you're using the Console or the REST API with an SDK, CLI, or other tool. If you get a message that you don't have permission or are unauthorized, verify with the tenancy administrator what type of access you have and which compartment  your access works in.

For administrators: For more information about the IAM policies that are needed to create and update a compute instance, see Creating an Instance.

Before You Begin

  • Service gateways or public IP addresses: The compute instance must have either a public IP address or a service gateway to be able to send compute instance metrics to the Monitoring service.

    If the instance does not have a public IP address, set up a service gateway on the virtual cloud network (VCN). The service gateway lets the instance send compute instance metrics to the Monitoring service without the traffic going over the internet. Here are special notes for setting up the service gateway to access the Monitoring service:

    • When creating the service gateway, enable the service label called All <region> Services in Oracle Services Network. It includes the Monitoring service.
    • When setting up routing for the subnet that contains the instance, set up a route rule with Target Type set to Service Gateway, and the Destination Service set to All <region> Services in Oracle Services Network.

    For detailed instructions, see Access to Oracle Services: Service Gateway.

  • Oracle Cloud Agent: The Oracle Cloud Agent software must be installed on the instance. Oracle Cloud Agent is installed by default on current platform images. For steps to manually install Oracle Cloud Agent on older images, see Installing the Oracle Cloud Agent Software.
  • Compute Instance Monitoring plugin: For the instance to emit the compute instance metrics, the Compute Instance Monitoring plugin must be enabled on the instance and plugins must be running. For more information about how to enable and run plugins, see Oracle Cloud Agent.

Enabling Monitoring for a New Compute Instance

To configure a new compute instance to emit the compute instance metrics, use the following steps.

Creating a Monitoring-Enabled Instance Using the Console

  1. Follow the steps to create an instance, until the advanced options. Ensure that the instance has either a public IP address or a service gateway, as described in the prerequisites.
  2. Click Show Advanced Options.
  3. On the Oracle Cloud Agent tab, select Compute Instance Monitoring.

    Note

    If you're using an older platform image or a custom image that is not based on a recent platform image, you must manually install the Oracle Cloud Agent software. You can do this by providing a cloud-init script. For more information, see Installing the Oracle Cloud Agent Software. Compare the date of the image to the date listed in Supported Images.
  4. Click Create.

    The newly created, monitoring-enabled instance emits compute instance metrics to the Monitoring service.

Creating a Monitoring-Enabled Instance Using the API

Use the LaunchInstance operation. Include the following parameters:

{
  "agentConfig": {
    "isMonitoringDisabled": false,
    "areAllPluginsDisabled": false,
    "pluginsConfig": [
      {
        "name": "Compute Instance Monitoring",
        "desiredState": "ENABLED"
      }
    ]
  }
}

Ensure that the instance has either a public IP address or a service gateway, as described in the prerequisites.

Note

If you're using an older platform image or a custom image that is not based on a recent platform image, you must manually install the Oracle Cloud Agent software. You can do this by providing a cloud-init script. For more information, see Installing the Oracle Cloud Agent Software. Compare the date of the image to the date listed in Supported Images.

Enabling Monitoring for an Existing Compute Instance

To configure an existing compute instance to emit the compute instance metrics, use the following steps.

Managing the Compute Instance Monitoring Plugin

For an instance to emit the compute instance metrics, the Compute Instance Monitoring plugin must be enabled on the instance and plugins must be running.

If you want to temporarily prevent the instance from emitting compute instance metrics, you can disable the Compute Instance Monitoring plugin. You can also stop all of the plugins that run on the instance, including the Compute Instance Monitoring plugin.

Caution

Functionality that depends on the plugin, such as monitoring and autoscaling, does not work when the plugin is disabled or stopped.

For more information about how to enable and run plugins, see Oracle Cloud Agent.

Troubleshooting: Finding Out if Monitoring Has Your Metrics

To determine whether Monitoring is receiving the compute instance metrics, you can either query the instance metrics, or view the instance properties to confirm that the Compute Instance Monitoring plugin is enabled and running.