CloudWatch 代理 CPU 收集的指标未显示

CloudWatch agent CPU collected metrics not displayed

我已经在 EC2 微型实例上安装了 CloudWatch 代理 运行 Ubuntu 16,主要遵循这个非常好的教程:https://www.youtube.com/watch?v=vAnIhIwE5hY 本教程显示了 Windows 实例上的安装,但超过 90% 的解释在 Linux 上也能正常工作。

我完成安装后,CloudWatch 收集的指标开始在我的 AWS CloudWatch 控制台上正常显示,除了找不到 CPU 相关指标。

下面是我使用的 json 配置文件。除 CPU 相关指标 ("cpu_usage_idle","cpu_usage_iowait","cpu_usage_user","cpu_usage_system")

外,所有定义的指标均可访问

我使用向导创建了 json。

为了获得这些指标,我还应该做些什么吗?

{
    "agent": {
        "metrics_collection_interval": 60,
        "run_as_user": "root"
    },
    "metrics": {
        "append_dimensions": {
            "AutoScalingGroupName": "${aws:AutoScalingGroupName}",
            "ImageId": "${aws:ImageId}",
            "InstanceId": "${aws:InstanceId}",
            "InstanceType": "${aws:InstanceType}"
        },
        "metrics_collected": {
            "collectd": {
                "metrics_aggregation_interval": 60
            },
            "cpu": {
                "measurement": [
                    "cpu_usage_idle",
                    "cpu_usage_iowait",
                    "cpu_usage_user",
                    "cpu_usage_system"
                ],
                "metrics_collection_interval": 60,
                "totalcpu": false
            },
            "disk": {
                "measurement": [
                    "used_percent",
                    "inodes_free"
                ],
                "metrics_collection_interval": 60,
                "resources": [
                    "*"
                ]
            },
            "diskio": {
                "measurement": [
                    "io_time"
                ],
                "metrics_collection_interval": 60,
                "resources": [
                    "*"
                ]
            },
            "mem": {
                "measurement": [
                    "mem_used_percent",
                    "mem_free"
                ],
                "metrics_collection_interval": 60
            },
            "statsd": {
                "metrics_aggregation_interval": 60,
                "metrics_collection_interval": 10,
                "service_address": ":8125"
            },
            "swap": {
                "measurement": [
                    "swap_used_percent"
                ],
                "metrics_collection_interval": 60
            }
        }
    }
}

如评论中所述,缺少 "resources": [ "*" ],

来自文档:

cpu – Optional. Specifies that CPU metrics are to be collected. This section is valid only for Linux instances. You must include at least one of the resources and totalcpu fields for any CPU metrics to be collected. This section can include the following fields:

resources – Optional. Specify this field with a value of * to cause per-cpu metrics are to be collected. The only allowed value is *.

CloudWatch Agent Configuration File: Metrics Section.