Creating an Agent Configuration

Create an agent configuration in Logging to ingest metric data into a custom metric.

    1. Open the navigation menu and click Observability & Management. Under Monitoring, click Agent Configurations.
    2. Under List Scope, select a compartment that you have permission to work in.
    3. Click Create agent config.
    4. In the Create agent configuration panel, enter a name and description for the configuration. Avoid entering confidential information.
    5. Select the compartment that you want to create the configuration in.
    6. Under Choose host groups, for Group type, select an option, and then select the group that you want.
      For example, select Dynamic group, then select the dynamic group that matches the resources with the agent configurations.
    7. Under Agent configuration, enter the base URL to the metric input.

      For example, expose metrics from a virtual machine (VM) using an HTTP endpoint in Prometheus format:

      http://1.2.3.4:9100/metrics
    8. Optionally click Another endpoint to add another endpoint.
      All endpoints go to the same compartment and namespace.
    9. Under Select metric destination, select the compartment and metric namespace that you want to publish custom metrics to.
    10. (Optional) Click Show additional options. Under Add Tags, add tags as needed.
    11. Click Create.
    The agent configuration is created and appears in the Agent Configurations page.
  • Use the oci logging agent-configuration create command and required parameters to create an agent configuration:

    oci logging agent-configuration create compartment-id compartment_ocid --is-enabled [true|false] --service-configuration service_configuration [OPTIONS]
    Example command and JSON files
    oci logging agent-configuration create --description <description> \
    --display-name <display_name> --group-association file://group-association.json \
    --compartment-id <compartment_id> --is-enabled true \
    --service-configuration file://create-service-configuration.json --wait-for-state SUCCEEDED --max-wait-seconds 60

    group-association.json:

    {
      "groupList": [
        "<dynamic_group_id>"
      ]
    }

    create-service-configuration.json:

    {
        "configurationType": "MONITORING",
        "applicationConfigurations": [
          {
            "sourceType": "KUBERNETES",
            "source": {
              "name": "KUBERNETES-uniqueid",
              "scrapeTargets": [
                {
                  "resourceType": "PODS",
                  "k8sNamespace": "k8s-namespace"
                }
              ]
            },
            "destination": {
              "compartmentId": "<compartment_id>",
              "metricsNamespace": "metricsnamespace"
            },
            "filter": {
              "allowList": [
                "regex-test"
              ],
              "denyList": [],
              "filterType": "KUBERNETES_FILTER",
              "name": "test"
            }
          }
        ]
      }

    For a complete list of parameters and values for CLI commands, see the CLI Command Reference.

  • Run the CreateUnifiedAgentConfiguration operation to create an agent configuration.

    Example API request
    POST /20200531/unifiedAgentConfigurations
    Host: https://logging.us-phoenix-1.oci.oraclecloud.com
    <authorization and other headers>
    {
      "serviceConfiguration": {
        "configurationType": "MONITORING",
        "applicationConfigurations": [
          {
            "sourceType": "KUBERNETES",
            "source": {
              "name": "KUBERNETES-uniqueid",
              "scrapeTargets": [
                {
                  "resourceType": "PODS",
                  "k8sNamespace": "k8s-namespace"
                }
              ]
            },
            "destination": {
              "compartmentId": "<compartment_id>",
              "metricsNamespace": "metricsnamespace"
            },
            "filter": {
              "allowList": [
                "regex-test"
              ],
              "denyList": [],
              "filterType": "KUBERNETES_FILTER",
              "name": "test"
            }
          }
        ]
      },
      "displayName": "mar-test",
      "isEnabled": true,
      "groupAssociation": {
        "groupList": [
          "<dynamic_group_id>"
        ]
      },
      "description": "test",
      "compartmentId": "<compartment_id>"
    }