Amazon ECS Managed Instances 이 페이지는 아직 한국어로 제공되지 않습니다. 번역 작업 중입니다.
현재 번역 프로젝트에 대한 질문이나 피드백이 있으신 경우
언제든지 연락주시기 바랍니다. Datadog Container Monitoring enables visibility into applications running on Amazon ECS Managed Instances .
How it works To monitor your ECS Managed Instances tasks with Datadog, run the Datadog Agent as a container in same task definition as your application container. When a Datadog Agent is run as an additional container within an ECS task definition, the Agent can use the task’s metadata endpoint to collect data. This endpoint returns a Docker stats JSON for all containers associated with the task.
For more information about the collected Docker stats, see Docker API: ContainerStats in the Docker documentation.
Setup This setup requires Datadog Agent 7.73.0+.
The following instructions assume that you have configured an ECS Managed Instances cluster. See the Amazon ECS Managed Instances documentation for creating a cluster .
Create an ECS Managed Instances task definition file Register the task definition Run the task as a replica service Create an ECS Managed Instances task definition file This ECS task definition launches the Datadog Agent container with the necessary configurations.
Download datadog-agent-ecs-managed-instances-sidecar.json . This files provide minimal configuration for core infrastructure monitoring. For more sample task definition files with various features enabled, see the Set up additional Agent features section on this page. Modify the task definition file: (Optional) To add an Agent health check, add the following line to your ECS task definition:"healthCheck" : {
"retries" : 3 ,
"command" : [ "CMD-SHELL" , "agent health" ],
"timeout" : 5 ,
"interval" : 30 ,
"startPeriod" : 15
}
Register the task definition Log in to your AWS Console and navigate to the Elastic Container Service section. Select Task Definitions in the navigation pane. On the Create new task definition menu, select Create new task definition with JSON . In the JSON editor box, paste the contents of your task definition file. Select Create . Use the AWS CLI to execute the following command:
aws ecs register-task-definition --cli-input-json file://<path to datadog-agent-ecs-managed-instances-sidecar.json>
Run the task as a replica service Because ECS Managed Instances does not support daemon scheduling, run the task as a replica service .
Log in to your AWS Web Console and navigate to the Elastic Container Service section. Choose the cluster to run the Datadog Agent on. On the Services tab, click Create . For Task Definition , select the task created in the previous steps. Enter a Service name . For Launch type , choose Capacity Provider and select the Manged Instance capacity provider tied to the cluster. For Number of tasks , enter 1. Click Next step . Fill in the rest of the optional fields based on your preference. Click Next step . Click Create service . Use the AWS CLI to execute the following command:
aws ecs create-service --cluster <CLUSTER_NAME> \
--service-name <SERVICE_NAME> \
--task-definition <TASK_DEFINITION_ARN> \
--desired-count 1 \
--network-configuration "awsvpcConfiguration={subnets=[subnet-abcd1234],securityGroups=[sg-abcd1234]}"
Set up additional Datadog Agent features Metrics collection Docker labels are not supported for ECS Managed Instances. To provide a custom integration configuration, you must mount a configuration file directly onto the Datadog Agent container.
Example : Setting up a Datadog Agent with custom configuration files mounted
Create the following file structure:
|- datadog
|- Dockerfile
|- conf.d
|-redis.yaml
The redis.yaml file contains the configurations for the Redis integration.
Copy
ad_identifiers :
- redis
init_config :
instances :
- host : %%host%%
port : 6379 The Dockerfile is used to build a Datadog Agent image and include the redis.yaml file at the correct location:
Copy
FROM public.ecr.aws/datadog/agent:latest
COPY conf.d/ /etc/datadog-agent/conf.d/After the image is built and pushed to an image registry, reference the custom image in the ECS task definition:
{
"containerDefinitions": [
{
"image": "<registry-domain>/<namespace-or-account>/<repository>:<tag>",
"name": "datadog-agent",
...
}
],
...
}
Trace collection (APM) Instrument your application based on your setup:
UDP To collect traces over UDP, do not set DD_AGENT_HOST. Keep the default localhost value.
UDS To collect traces over UDS:
Add an empty volume onto the task definition using the volumes parameter. Mount the volume onto the agent and application container using the mountPoints parameter. Configure the environmental variable DD_DOGSTATSD_SOCKET on the application container and set it to /var/run/datadog/dsd.socket. Example : Container definitions that configure collecting traces over UDS
{
"containerDefinitions" : [
{
"image" : "datadog/agent:latest" ,
"mountPoints" : [
{
"containerPath" : "/var/run/datadog" ,
"readOnly" : false ,
"sourceVolume" : "dd-sockets"
}
],
"name" : "datadog-agent" ,
...
...
},
{
"environment" : [
{
"name" : "DD_DOGSTATSD_SOCKET" ,
"value" : "/var/run/datadog/dsd.socket"
}
],
"mountPoints" : [
{
"containerPath" : "/var/run/datadog" ,
"readOnly" : false ,
"sourceVolume" : "dd-sockets"
}
],
"name" : "app" ,
...
...
}
],
...
"volumes" : [
{
"host" : {},
"name" : "dd-sockets"
}
]
}
Log collection The setup for log collection is identical to the setup for log collection in ECS Fargate. Follow the instructions in the ECS Fargate documentation . These instructions give you the option to use either AWS FireLens in combination with Datadog’s Fluent Bit output plugin, or the awslogs log driver.
Process collection You can monitor processes in ECS Managed Instances in Datadog by using the Live Processes page . To enable process collection, add the PidMode parameter in the task definition and set it to task as follows:
Troubleshooting Need help? Contact Datadog support .
Further reading