You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

无法建立Dynatrace与ECS Fargate连接,请求技术协助

ECS Fargate与Dynatrace SaaS连接排查请求

我已依据Dynatrace官方文档配置ECS Fargate与Dynatrace SaaS的连接,以下是我的任务定义:

{
    "taskDefinitionArn": "arn:ecs:us-east-1:329599655752:task-definition/Dynatrace-Fargate-Agent-Task:2",
    "containerDefinitions": [
        {
            "name": "install-oneagent",
            "image": "alpine:3",
            "cpu": 819,
            "memory": 3072,
            "memoryReservation": 1024,
            "portMappings": [
                {
                    "name": "install-oneagent-80-tcp",
                    "containerPort": 80,
                    "hostPort": 80,
                    "protocol": "tcp",
                    "appProtocol": "http"
                }
            ],
            "essential": false,
            "entryPoint": [
                "/bin/sh"
            ],
            "command": [
                "-c",
                "ARCHIVE=$(mktemp) && wget -O $ARCHIVE \"$DT_API_URL/v1/deployment/installer/agent/unix/paas/latest?Api-Token=$DT_PAAS_TOKEN&$DT_ONEAGENT_OPTIONS\" && unzip -o -d /opt/dynatrace/oneagent $ARCHIVE && rm -f $ARCHIVE"
            ],
            "environment": [
                {
                    "name": "DT_PAAS_TOKEN",
                    "value": "PaaS Token"
                },
                {
                    "name": "DT_ONEAGENT_OPTIONS",
                    "value": "flavor=default&include=all"
                },
                {
                    "name": "DT_API_URL",
                    "value": "https://dhu46207.live.dynatrace.com/api"
                }
            ],
            "mountPoints": [
                {
                    "sourceVolume": "oneagent",
                    "containerPath": "/opt/dynatrace/oneagent",
                    "readOnly": false
                }
            ],
            "volumesFrom": [],
            "logConfiguration": {
                "logDriver": "awslogs",
                "options": {
                    "awslogs-group": "/ecs/Dynatrace-Fargate-Agent-Task",
                    "mode": "non-blocking",
                    "awslogs-create-group": "true",
                    "max-buffer-size": "25m",
                    "awslogs-region": "us-east-1",
                    "awslogs-stream-prefix": "ecs"
                }
            },
            "systemControls": []
        },
        {
            "name": "nginx-latest",
            "image": "nginx:latest",
            "cpu": 205,
            "memory": 3072,
            "memoryReservation": 1024,
            "portMappings": [],
            "essential": true,
            "environment": [
                {
                    "name": "LD_PRELOAD",
                    "value": "/opt/dynatrace/oneagent/agent/lib64/liboneagentproc.so"
                }
            ],
            "mountPoints": [],
            "volumesFrom": [],
            "dependsOn": [
                {
                    "containerName": "install-oneagent",
                    "condition": "COMPLETE"
                }
            ],
            "systemControls": []
        }
    ],
    "family": "Dynatrace-Fargate-Agent-Task",
    "executionRoleArn": "arn:iam::329599655752:role/ecsTaskExecutionRole",
    "networkMode": "awsvpc",
    "revision": 2,
    "volumes": [
        {
            "name": "oneagent",
            "host": {}
        }
    ],
    "status": "ACTIVE",
    "requiresAttributes": [
        {
            "name": "com.amazonaws.ecs.capability.logging-driver.awslogs"
        },
        {
            "name": "ecs.capability.execution-role-awslogs"
        },
        {
            "name": "com.amazonaws.ecs.capability.docker-remote-api.1.19"
        },
        {
            "name": "com.amazonaws.ecs.capability.docker-remote-api.1.28"
        },
        {
            "name": "com.amazonaws.ecs.capability.docker-remote-api.1.21"
        },
        {
            "name": "ecs.capability.container-ordering"
        },
        {
            "name": "com.amazonaws.ecs.capability.docker-remote-api.1.18"
        },
        {
            "name": "ecs.capability.task-eni"
        },
        {
            "name": "com.amazonaws.ecs.capability.docker-remote-api.1.29"
        }
    ],
    "placementConstraints": [],
    "compatibilities": [
        "EC2",
        "FARGATE"
    ],
    "requiresCompatibilities": [
        "FARGATE"
    ],
    "cpu": "1024",
    "memory": "3072",
    "runtimePlatform": {
        "cpuArchitecture": "X86_64",
        "operatingSystemFamily": "LINUX"
    },
    "registeredAt": "2025-02-17T10:44:59.073Z",
    "enableFaultInjection": false,
    "tags": []
}

我已正确生成PaaS Token,不存在令牌相关问题。使用该任务定义创建服务后,one-agent容器以状态码0退出,但在Dynatrace SaaS环境中无法看到该Fargate实例,且容器日志无报错信息。


排查建议

  • 修复容器卷共享配置:当前nginx容器未挂载oneagent共享卷,导致LD_PRELOAD指定的Agent文件路径不存在。需要给nginx-latest容器添加如下mountPoints配置:
    "mountPoints": [
        {
            "sourceVolume": "oneagent",
            "containerPath": "/opt/dynatrace/oneagent",
            "readOnly": false
        }
    ]
    
  • 验证Agent安装完整性:修改install-oneagent容器的命令,增加文件存在校验,确认Agent是否正确下载解压:
    "-c", "ARCHIVE=$(mktemp) && wget -O $ARCHIVE \"$DT_API_URL/v1/deployment/installer/agent/unix/paas/latest?Api-Token=$DT_PAAS_TOKEN&$DT_ONEAGENT_OPTIONS\" && unzip -o -d /opt/dynatrace/oneagent $ARCHIVE && ls -l /opt/dynatrace/oneagent/agent/lib64/liboneagentproc.so && rm -f $ARCHIVE"
    
    查看install容器日志,确认文件存在。
  • 检查网络连通性:确保Fargate任务所在VPC的安全组和NACL允许出站HTTPS(443)流量到dhu46207.live.dynatrace.com,Agent需要向该端点上报数据。
  • 补充Agent配置参数:在DT_ONEAGENT_OPTIONS中明确指定租户和集群信息,比如:
    flavor=default&include=all&tenant=dhu46207&clusterid=live
    
  • 检查nginx容器日志:查看nginx容器的启动日志,确认是否有liboneagentproc.so加载失败的报错,这是定位问题的关键线索。

内容的提问来源于stack exchange,提问作者Jainish Chauhan

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.14 10:34:54