我正试图在我的ek集群上安装cw代理,以获得实例级别的度量,特别是mem_used_percent度量,可以有人指出我的错误所在,我已经将cwagent服务器策略附加到了eks节点上。
我看到了所有容器洞察指标,但在cw代理(aws控制台)中看不到任何指标。
我在这里错过了什么?
我的config_file
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图片: amazon/cloudwatch-agent:1.247348.0b251302 CI_VERSION:"k8s/1.3.7“
My_logs:
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发布于 2022-03-08 23:01:21
度量集合(如内存使用情况)需要放在json文件的metrics部分,而不是logs部分。在aws doco中解释。您只需重命名第一节,我认为您在最后有一个额外的}。
下列措施应能发挥作用:
"metrics": {
"metrics_collected": {
"kubernetes": {
"cluster_name": "xxxx",
"metrics_collection_interval": 60
},
"mem": {
"measurement": [
"mem_used_percent"
],
"metrics_collection_interval": 60
}
},
"force_flush_interval": 5
}https://stackoverflow.com/questions/68232283
复制相似问题