You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Ubuntu22.04启动CloudWatch Agent失败:缺失common-config.toml问题

Amazon CloudWatch Agent 缺失 common-config.toml 问题解决

操作背景与问题现象

在Ubuntu 22.04(arm64)环境中执行以下操作后触发错误:

  • 下载安装包:
    wget https://amazoncloudwatch-agent.s3.amazonaws.com/ubuntu/arm64/latest/amazon-cloudwatch-agent.deb
    
  • 查看Agent版本:
    /opt/aws/amazon-cloudwatch-agent/bin/amazon-cloudwatch-agent-ctl -m ec2 -a status
    
    输出:
    {
      "status": "stopped",
      "starttime": "",
      "configstatus": "not configured",
      "version": "1.300032.2b361"
    }
    
  • 启动Agent时执行:
    sudo /opt/aws/amazon-cloudwatch-agent/bin/amazon-cloudwatch-agent-ctl -a fetch-config -m onPremise -s -c file:/opt/aws/amazon-cloudwatch-agent/etc/amazon-cloudwatch-agent.json
    
    报错:
    processing amazon-cloudwatch-agent 2024/01/08 09:45:20 E! Failed to open Common Config: open /opt/aws/amazon-cloudwatch-agent/etc/common-config.toml: no such file or directory
    

安装过程无报错,但/opt/aws/amazon-cloudwatch-agent/etc目录下仅有空目录amazon-cloudwatch-agent.d;手动编辑amazon-cloudwatch-agent.json后启动仍提示缺失文件,配置向导也无法生成该文件。

问题分析与解决方案

1. 版本特性说明

版本1.300032.2b361属于Beta版本,配置依赖逻辑与稳定版不同,默认不会自动生成common-config.toml,但该文件是Agent启动的必要依赖。

2. 手动创建缺失文件

在/opt/aws/amazon-cloudwatch-agent/etc/目录下创建common-config.toml,基础模板如下(按需替换区域等参数):

[agent]
region = "us-east-1"  # 替换为你的AWS区域
logfile = "/opt/aws/amazon-cloudwatch-agent/logs/amazon-cloudwatch-agent.log"

3. 重新启动Agent

创建文件后重新执行启动命令:

sudo /opt/aws/amazon-cloudwatch-agent/bin/amazon-cloudwatch-agent-ctl -a fetch-config -m onPremise -s -c file:/opt/aws/amazon-cloudwatch-agent/etc/amazon-cloudwatch-agent.json

4. 切换到稳定版(推荐生产环境)

若Beta版本仍存在不稳定情况,建议安装稳定版:

wget https://amazoncloudwatch-agent.s3.amazonaws.com/ubuntu/arm64/amazon-cloudwatch-agent-latest.deb

稳定版安装后会自动生成完整的配置文件框架,无需手动创建依赖文件。

疑问解答

  • 该Agent版本是否存在问题?
    此Beta版本的配置逻辑属于版本特性,并非Bug,但稳定性逊于正式版,生产环境优先选择稳定版。
  • 此版本默认不包含这类配置文件吗?
    是的,该Beta版本默认不会自动生成common-config.toml,需要手动创建或通过完整配置流程生成。

内容的提问来源于stack exchange,提问作者GGB

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.02 17:40:29