简体   繁体   English

亚马逊 cloudwatch 代理不工作

[英]Amazon cloudwatch agent not working

I'm trying to add aws cloudwatch agent to see additional metrics using tutorial我正在尝试添加 aws cloudwatch 代理以使用教程查看其他指标

A brief review of what I did:简要回顾一下我所做的:

  1. Create AIM role and attach to EC2 instance doc (NOTE: I do not use Parameter Store just for communication between EC2 and cloudwatch)创建 AIM 角色并附加到 EC2 实例文档(注意:我不使用 Parameter Store 只是为了 EC2 和 cloudwatch 之间的通信)
  2. Install Agent using s3 link使用 s3 链接安装代理
  3. Create agent configuration file docs创建代理配置文件文档
  4. Run agent using CLI dosc使用 CLI dosc运行代理

But it still not working and in agent log, I see errors like但它仍然无法正常工作,在代理日志中,我看到类似的错误

ec2tagger: Unable to initialize EC2 Instance Tags: +NoCredentialProviders: no valid providers in chain. ec2tagger:无法初始化 EC2 实例标签:+NoCredentialProviders:链中没有有效的提供者。 Deprecated.已弃用。 For verbose messaging see aws.Config.CredentialsChainVerboseErrors有关详细消息,请参阅 aws.Config.CredentialsChainVerboseErrors

While googling I found not much related to cloudwath just only that in AIM role in 'Trust Relationship' config ec2 should be mentioned in service section and it is:在谷歌搜索时,我发现与 cloudwath 没有太大关系,只是在“信任关系”配置 ec2 中的 AIM 角色中应该在服务部分中提及,它是:

    {
  "Version": "2012-10-17",
  "Statement": [
    {
      "Sid": "",
      "Effect": "Allow",
      "Principal": {
        "Service": "ec2.amazonaws.com"
      },
      "Action": "sts:AssumeRole"
    }
  ]
}

Any ideas, thanks??任何想法,谢谢?

"The first procedure creates the IAM role that you must attach to each Amazon EC2 instance that runs the CloudWatch agent. This role provides permissions for reading information from the instance and writing it to CloudWatch." “第一个过程创建 IAM 角色,您必须将其附加到运行 CloudWatch 代理的每个 Amazon EC2 实例。此角色提供从实例读取信息并将其写入 CloudWatch 的权限。” in docs文档中

please attach IAM role that you created to your ec2 instance first,it works for me请先将您创建的 IAM 角色附加到您的 ec2 实例,它对我有用

In my case the instance had an IAM role attached, but the role was missing the ec2:DescribeTags permission.在我的例子中,该实例附加了一个 IAM 角色,但该角色缺少ec2:DescribeTags权限。 Adding that fixed the problem.添加解决了问题。

The cloudwatch agent process that runs in the ec2 should be able to describe the tags of ec2.在ec2中运行的cloudwatch代理进程应该能够描述ec2的标签。 The permission required for that is ec2:DescribeTags .所需的权限是ec2:DescribeTags

Attaching instance role with the managed policy arn:aws:iam::aws:policy/CloudWatchAgentServerPolicy will resolve the problem.使用托管策略arn:aws:iam::aws:policy/CloudWatchAgentServerPolicy附加实例角色将解决问题。

检查 CloudWatch 代理服务是否正在运行(已启动)

I got the same issue, resolve by using below command, refresh routes我遇到了同样的问题,使用以下命令解决,刷新路由

Import-Module C:\ProgramData\Amazon\EC2-Windows\Launch\Module\Ec2Launch.psm1; Add-Routes

通过从实例内部运行aws configure解决

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM