Docs » Splunk Distribution of the OpenTelemetry Collector の利用開始 » Other Collector deployment tools and options: ECS/EC2, Fargate, Nomad, PCF » Amazon ECS EC2 でCollectorをデプロイする

Amazon ECS EC2 でCollectorをデプロイする 🔗

Use the guided setup to deploy the Collector as a sidecar in an Amazon ECS EC2 cluster.

AWSインテグレーションのガイド付きセットアップにアクセスするには、以下の手順を実行します:

  1. Splunk Observability Cloud にログインします。

  2. ナビゲーションメニューで、Data Management を選択します。

  3. Available integrations タブにアクセスするか、Deployed integrations タブで Add Integration を選択します。

  4. Select the tile for Amazon ECS EC2.

  5. Follow the steps provided in the guided setup, which provides a JSON task definition for the Collector.

以下のCollector 構成オプションのいずれかを選択します:

Add the Collector as a sidecar 🔗

注釈

To use this option you need to be familiar with Amazon ECS EC2 launch. See Getting started with the classic console using Amazon EC2 for further reading.

Open the ECS task definition in which you’ll add the Collector sidecar:

  1. リポジトリ から Collector のタスク定義を探します。

  2. Collectorの定義を既存のECSタスク定義にマージします。

  3. Replace MY_SPLUNK_ACCESS_TOKEN and MY_SPLUNK_REALM with valid values. You can pin the image version to a specific version instead of latest if you want to avoid automatic upgrades.

Collector は、デフォルトのコンフィギュレーションファイル /etc/otel/collector/ecs_ec2_config.yaml を使用するように設定されています。CollectorイメージDockerfileは Dockerfile から入手でき、デフォルトの構成ファイルの内容は ECS EC2 構成 で見ることができます。

備考:

  • You do not need the awsecscontainermetrics receiver in the default configuration file if all you want is tracing. You can take the default configuration, remove the receiver, then use the configuration in a custom configuration following the directions in Deploy the Collector using a custom configuration.

  • To exclude metrics assign them as a stringified array to environment variable METRICS_TO_EXCLUDE.

  • You can set the memory limit for the memory_limiter processor using environment variable SPLUNK_MEMORY_LIMIT_MIB. The default memory limit is 512 MiB.

Deploy the Collector using a custom configuration 🔗

カスタム構成ファイルを使用するには、Collectorタスク定義で SPLUNK_CONFIG 環境変数の値をカスタム構成ファイルのファイルパスに置き換えます。

あるいは、Configure the Amazon Elastic Container Service Observer extension で説明されているように、SPLUNK_CONFIG_YAML 環境変数を使用してカスタムコンフィギュレーション YAML を直接指定することもできます。

Configure the Amazon Elastic Container Service Observer extension 🔗

Use the Amazon Elastic Container Service Observer (ecs_observer) extension in your custom configuration to discover metric targets in running tasks, filtered by service names, task definitions, and container labels.

前提条件 🔗

以下が該当します:

  • The Collector must run as an ECS daemon. See Launch the Collector as a daemon from the ECS console.

  • The ECS Observer is currently limited to Prometheus targets.

  • The ECS Observer requires the read-only permissions below. Add them to the customer-managed policy that is attached to the task role.

ecs:List*
ecs:Describe*

Launch the Collector as a daemon from the ECS console 🔗

To launch the Collector from the Amazon ECS console:

  1. Go to your cluster in the console and select Services.

  2. Select Create and define the following options:

  • Launch Type: EC2

  • Task Definition (Family): splunk-otel-collector

  • Task Definition (Revision): 1 (or whatever the latest is in your case)

  • Service Name: splunk-otel-collector

  • Service type: DAEMON

  1. Leave everything else as default and proceed to Next step until you’re required to create the service.

  2. Create Service を選択して、ECSクラスターの各ノードにCollectorをデプロイします。インフラとDockerのメトリクスがすぐに表示されるはずです。

設定例 🔗

The following example configures the ecs_observer to find Prometheus targets in the lorem-ipsum-cluster cluster and us-west-2 region, where the task ARN pattern is ^arn:aws:ecs:us-west-2:906383545488:task-definition/lorem-ipsum-task:[0-9]+$. The results are written to /etc/ecs_sd_targets.yaml.

The prometheus receiver is configured to read targets from the results file. The values for access_token and realm are read from the SPLUNK_ACCESS_TOKEN and SPLUNK_REALM environment variables, which you must specify in your container definition.

extensions:
  ecs_observer:
    refresh_interval: 10s
    cluster_name: 'lorem-ipsum-cluster'
    cluster_region: 'us-west-2'
    result_file: '/etc/ecs_sd_targets.yaml'
    task_definitions:
      - arn_pattern: "^arn:aws:ecs:us-west-2:906383545488:task-definition/lorem-ipsum-task:[0-9]+$"
       metrics_ports: [9113]
       metrics_path: /metrics
receivers:
  prometheus:
    config:
      scrape_configs:
        - job_name: 'lorem-ipsum-nginx'
          scrape_interval: 10s
          file_sd_configs:
            - files:
                - '/etc/ecs_sd_targets.yaml'
processors:
  batch:
  resourcedetection:
    detectors: [ecs]
    override: false
exporters:
  signalfx:
    access_token: ${SPLUNK_ACCESS_TOKEN}
    realm: ${SPLUNK_REALM}
service:
  extensions: [ecs_observer]
  pipelines:
    metrics:
      receivers: [prometheus]
      processors: [batch, resourcedetection]
      exporters: [signalfx]

Deploy the Collector using the AWS Parameter Store 🔗

To use the AWS Parameter Store, specify the config YAML directly in the SPLUNK_CONFIG_YAML environment variable instead of using SPLUNK_CONFIG.

注釈

To have read access to the Parameter Store add the policy AmazonSSMReadOnlyAccess to the task role. See Systems manager parameter store for more information.

以下の手順に従ってください:

  1. Store the custom configuration for the Configure the Amazon Elastic Container Service Observer extension in the parameter splunk-otel-collector-config in the AWS Systems Manager Parameter Store.

  2. Next, assign the splunk-otel-collector-config parameter to SPLUNK_CONFIG_YAML using the valueFrom option, as shown in the following example:

{
"name": "lorem-ipsum-cluster",
"valueFrom": "^arn:aws:ecs:us-west-2:906383545488:task-definition/lorem-ipsum-task:[0-9]+$""
}

注意

The AWS Parameter Store limits the size of the config file to 4096 bytes.

このページは 2024年11月26日 に最終更新されました。