How to start the cloudwatch agent in container?

后端 未结 5 1565
轮回少年
轮回少年 2021-02-09 02:54

From the docker hub there is an image which is maintained by amazon.

Any one know how to configure and start the container as I cannot find any documen

5条回答
  •  醉话见心
    2021-02-09 03:21

    try this dockerfile:

    FROM amazonlinux:2.0.20190508
    RUN yum -y install https://s3.amazonaws.com/amazoncloudwatch-agent/amazon_linux/amd64/latest/amazon-cloudwatch-agent.rpm
    COPY agent.json  /opt/aws/amazon-cloudwatch-agent/bin/default_linux_config.json
    ENV RUN_IN_CONTAINER=True
    ENTRYPOINT ["/opt/aws/amazon-cloudwatch-agent/bin/start-amazon-cloudwatch-agent"]
    

    json example:

      {
          "agent": {
            "metrics_collection_interval": 10,
            "logfile": "/opt/aws/amazon-cloudwatch-agent/logs/amazon-cloudwatch-agent.log"
          },
          "metrics": {
            "metrics_collected": {
              "cpu": {
                "resources": [
                  "*"
                ],
                "measurement": [
                  {"name": "cpu_usage_idle", "rename": "CPU_USAGE_IDLE", "unit": "Percent"},
                  {"name": "cpu_usage_nice", "unit": "Percent"},
                  "cpu_usage_guest"
                ],
                "totalcpu": false,
                "metrics_collection_interval": 10,
                "append_dimensions": {
                  "customized_dimension_key_1": "customized_dimension_value_1",
                  "customized_dimension_key_2": "customized_dimension_value_2"
                }
              },
              "disk": {
                "resources": [
                  "/",
       .
       .
       .
       .
    }
    

提交回复
热议问题