首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >CW代理没有从ek集群中获取mem_used_percent

CW代理没有从ek集群中获取mem_used_percent
EN

Stack Overflow用户
提问于 2021-07-02 23:56:32
回答 1查看 406关注 0票数 1

我正试图在我的ek集群上安装cw代理,以获得实例级别的度量,特别是mem_used_percent度量,可以有人指出我的错误所在,我已经将cwagent服务器策略附加到了eks节点上。

我看到了所有容器洞察指标,但在cw代理(aws控制台)中看不到任何指标。

我在这里错过了什么?

我的config_file

代码语言:javascript
复制
apiVersion: v1
data:
  # Configuration is in Json format. No matter what configure change you make,
  # please keep the Json blob valid.
  cwagentconfig.json: |
    {
      "logs": {
        "metrics_collected": {
          "kubernetes": {
            "cluster_name": "xxxx",
            "metrics_collection_interval": 60
          },
          "mem": {
            "measurement": [
              "mem_used_percent"
            ],
            "metrics_collection_interval": 60
          }
        },
        "force_flush_interval": 5
      }
    }
kind: ConfigMap
metadata:
  name: cwagentconfig
  namespace: amazon-cloudwatch

部署如下:https://raw.githubusercontent.com/aws-samples/amazon-cloudwatch-container-insights/latest/k8s-deployment-manifest-templates/deployment-mode/daemonset/container-insights-monitoring/cwagent/cwagent-daemonset.yaml

图片: amazon/cloudwatch-agent:1.247348.0b251302 CI_VERSION:"k8s/1.3.7“

  • kubectl版本 客户端版本: GitCommit:"d647ddbd755faf07169599a625faf302ffc34458",{主:“1”,小调:“16”,GitVersion:"v1.16.1",version.Info GitTreeState:“干净”,BuildDate:"2019-10-02T23:49:20Z",GoVersion:"go1.12.9",编译器:“gc”,平台:“达尔文/amd64 64”}服务器版本:version.Info{16:“1”,未成年人:“18+”,GitVersion:“v1.18.9-eks d1db3c”,GitCommit:"d1db3c46e55f95d6a7d3e5578689371318f95ff9",GitTreeState:“干净”,BuildDate:"2020-10-20T22:18:07Z",GoVersion:"go1.13.15",编译器:“gc”,平台:“linux/amd64 64”}

My_logs:

代码语言:javascript
复制
2021/07/02 23:49:06 I! I! Detected the instance is EC2
2021/07/02 23:49:03 Reading json config file path: /opt/aws/amazon-cloudwatch-agent/bin/default_linux_config.json ...
/opt/aws/amazon-cloudwatch-agent/bin/default_linux_config.json does not exist or cannot read. Skipping it.
2021/07/02 23:49:03 Reading json config file path: /etc/cwagentconfig/..2021_07_02_23_48_59.690305669/cwagentconfig.json ...
2021/07/02 23:49:03 Find symbolic link /etc/cwagentconfig/..data
2021/07/02 23:49:03 Find symbolic link /etc/cwagentconfig/cwagentconfig.json
2021/07/02 23:49:03 Reading json config file path: /etc/cwagentconfig/cwagentconfig.json ...
Valid Json input schema.
2021/07/02 23:49:03 I! attempt to access ECS task metadata to determine whether I'm running in ECS.
2021/07/02 23:49:04 W! retry [0/3], unable to get http response from http://169.254.170.2/v2/metadata, error: unable to get response from http://169.254.170.2/v2/metadata, error: Get "http://169.254.170.2/v2/metadata": context deadline exceeded (Client.Timeout exceeded while awaiting headers)
2021/07/02 23:49:05 W! retry [1/3], unable to get http response from http://169.254.170.2/v2/metadata, error: unable to get response from http://169.254.170.2/v2/metadata, error: Get "http://169.254.170.2/v2/metadata": context deadline exceeded (Client.Timeout exceeded while awaiting headers)
2021/07/02 23:49:06 W! retry [2/3], unable to get http response from http://169.254.170.2/v2/metadata, error: unable to get response from http://169.254.170.2/v2/metadata, error: Get "http://169.254.170.2/v2/metadata": context deadline exceeded (Client.Timeout exceeded while awaiting headers)
2021/07/02 23:49:06 I! access ECS task metadata fail with response unable to get response from http://169.254.170.2/v2/metadata, error: Get "http://169.254.170.2/v2/metadata": context deadline exceeded (Client.Timeout exceeded while awaiting headers), assuming I'm not running in ECS.
No csm configuration found.
No metric configuration found.
Configuration validation first phase succeeded

2021/07/02 23:49:06 I! Config has been translated into TOML /opt/aws/amazon-cloudwatch-agent/etc/amazon-cloudwatch-agent.toml
2021-07-02T23:49:06Z I! Starting AmazonCloudWatchAgent 1.247348.0
2021-07-02T23:49:06Z I! Loaded inputs: cadvisor k8sapiserver
2021-07-02T23:49:06Z I! Loaded aggregators:
2021-07-02T23:49:06Z I! Loaded processors: ec2tagger k8sdecorator
2021-07-02T23:49:06Z I! Loaded outputs: cloudwatchlogs
2021-07-02T23:49:06Z I! Tags enabled:
2021-07-02T23:49:06Z I! [agent] Config: Interval:1m0s, Quiet:false, Hostname:"ip-10-182-7-7.ec2.internal", Flush Interval:1s
2021-07-02T23:49:06Z I! [logagent] starting
2021-07-02T23:49:06Z I! [logagent] found plugin cloudwatchlogs is a log backend
EN

回答 1

Stack Overflow用户

发布于 2022-03-08 23:01:21

度量集合(如内存使用情况)需要放在json文件的metrics部分,而不是logs部分。在aws doco中解释。您只需重命名第一节,我认为您在最后有一个额外的}

下列措施应能发挥作用:

代码语言:javascript
复制
"metrics": {
  "metrics_collected": {
    "kubernetes": {
      "cluster_name": "xxxx",
      "metrics_collection_interval": 60
    },
    "mem": {
      "measurement": [
        "mem_used_percent"
      ],
      "metrics_collection_interval": 60
    }
  },
  "force_flush_interval": 5
}
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/68232283

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档