Creating an Agent Configuration

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

Agent configuration updates are detected and automatically loaded.

    1. On the Agent configurations list page under Monitoring, select Create agent config. If you need help finding the list page, see Listing Agent Configurations.
    2. In the Create agent configuration panel, enter a name and description for the configuration. Avoid entering confidential information.
    3. Select the compartment that you want to create the configuration in.
    4. 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.
    5. 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
    6. Optionally select Another endpoint to add another endpoint.
      All endpoints go to the same compartment and namespace.
    7. Under Select metric destination, select the compartment and metric namespace that you want to publish custom metrics to.
    8. (Optional) Add one or more tags to the agent configuration: Select Show additional options to show the Add Tags section.
      If you have permissions to create a resource, then you also have permissions to apply free-form tags to that resource. To apply a defined tag, you must have permissions to use the tag namespace. For more information about tagging, see Resource Tags. If you're not sure whether to apply tags, skip this option or ask an administrator. You can apply tags later.
    9. Select Create.
    The newly created agent configuration is listed on 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>"
    }