0

我使用异常检测创建了一个 CPU 利用率警报,这显示了一个带有预期 cpu 利用率(异常检测带)的图表,但警报显示“数据不足”并且没有 cpuutilization 的图形线。

aws cloudwatch describe-alarms给出以下输出,显示配置的指标(删除了帐户 ID)

{
    "MetricAlarms": [
        {
            "AlarmName": "ec2-cpu-anomaly-detection-2",
            "AlarmArn": "arn:aws:cloudwatch:eu-west-2:xxxx:ec2-cpu-anomaly-detection-2",
            "AlarmDescription": "EC2 CPU usage anomaly detection, acct",
            "AlarmConfigurationUpdatedTimestamp": "2021-05-06T13:29:08.848Z",
            "ActionsEnabled": true,
            "OKActions": [],
            "AlarmActions": [],
            "InsufficientDataActions": [],
            "StateValue": "INSUFFICIENT_DATA",
            "StateReason": "Unchecked: Initial alarm creation",
            "StateUpdatedTimestamp": "2021-05-06T13:29:08.848Z",
            "Dimensions": [],
            "EvaluationPeriods": 2,
            "ComparisonOperator": "GreaterThanUpperThreshold",
            "TreatMissingData": "missing",
            "Metrics": [
                {
                    "Id": "m1",
                    "MetricStat": {
                        "Metric": {
                            "Namespace": "AWS/EC2",
                            "MetricName": "CPUUtilization",
                            "Dimensions": []
                        },
                        "Period": 60,
                        "Stat": "Average",
                        "Unit": "Count"
                    },
                    "ReturnData": true
                },
                {
                    "Id": "e1",
                    "Expression": "ANOMALY_DETECTION_BAND(m1)",
                    "Label": "CPUUtilization (Expected)",
                    "ReturnData": true
                }
            ],
            "ThresholdMetricId": "e1"
        }
    ],
    "CompositeAlarms": []
}
4

1 回答 1

0

维度参数是将警报连接到指标的原因。此处维度参数的输出不显示任何内容。这意味着它与指标没有联系,因此没有图表线。维度输出应如下所示:

        "Dimensions": [
            {
                "Name": "InstanceId",
                "Value": "i-xxxxxxxxxxxxx"
            },
            {
                "Name": "ImageId",
                "Value": "ami-xxxxxxx"
            },
            {
                "Name": "path",
                "Value": "<partition path ie: /home>"
            },
            {
                "Name": "InstanceType",
                "Value": "<instance type ie: t2.small>"
            },
            {
                "Name": "device",
                "Value": "<device name ie:mapper/primary-home>"
            },
            {
                "Name": "fstype",
                "Value": "<filesystem type ie:ext4"
            }
        ],

如果您查看您尝试使用的指标的来源,您将看到预期值。

于 2021-06-10T17:19:39.400 回答