如何对cloudwatch代理进行docker化并收集以收集指标? [英] How to dockerize the cloudwatch agent and collectd to collect the metrics?
问题描述
我需要从我的 ECS实例
和
这些是我需要遵循的步骤
- 安装
I need to collect the custom metrics from my
ECS instances
and from the documentationThese are steps I need to follow
- Install aws cloudwatch agent
- Install collectd daemon
- Configure cloudwatch agent to get the metrics from collectd daemon
It seems I can
Dockerize the cloudwatch agent (which seems to be already done, but with lack of documentation)
Dockerize collectd daemon
Why to dockerize or not use awslogs driver for collecting metrics ?
Currently we already have some
services
running as docker instances managed byamazon ecs
and configured to useawslog driver
to send logs to amazon cloudwatch logs.But in order to collect more custom metrics from the services e.g
number of requests per particular user from service a
the only solution which aws suggested is to usecolletd
with curl plugin along withcloud watch agent
.As due to some scaling issues, instead of running
cloudwatch agent
andcollectd
in a instance. I want to run those as containers.Question:
Is there any way to run
cloudwatch agent in docker container
which can read the metrics fromcollectd daemon
which runs in different container but on the same machine ?解决方案you do not need to run cloudwatch agent in your container, do not forget the rule of thumb, one process per container.
All you need to push application logs to stdout or stderr of the container and docker daemon will take care of it.
Important Configuration:
All you need to set log driver to AWS log driver in the task definition.
Amazon CloudWatch Logs logging driver
The awslogs logging driver sends container logs to
Amazon CloudWatch Logs
. Log entries can be retrieved through the AWS Management Console or the AWS SDKs and Command Line Tools.Specifying a Log Configuration in your Task Definition
Before your containers can send logs to CloudWatch, you must specify the awslogs log driver for containers in your task definition. This section describes the log configuration for a container to use the awslogs log driver. For more information, see Creating a Task Definition.
"logConfiguration": { "logDriver": "awslogs", "options": { "awslogs-group": "awslogs-mysql", "awslogs-region": "us-west-2", "awslogs-stream-prefix": "awslogs-example" } }
这篇关于如何对cloudwatch代理进行docker化并收集以收集指标?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!