期望的效果:在 23 点之后和 11 点之前缩减实例和 CPU。
警报图表看起来正确,但警报没有被触发。阈值 >= 1,但它只会随机标记,大多数时候根本不会。
{
"metrics": [
[ "AWS/ECS", "CPUUtilization", "ClusterName", "fargate-test", "ServiceName", "api", { "stat": "Average", "id": "cpu", "visible": false } ],
[ { "id": "scale_down_hours_cpu", "label": "scale-down-hours-cpu", "expression": "(IF(HOUR(cpu) < 11, 1, 0) OR IF(HOUR(cpu) >= 23, 1, 0)) AND IF(cpu <= 10, 1, 0)", "visible": true } ],
[ { "id": "scale_down_cpu", "label": "scale-down-cpu", "expression": "IF(cpu < 10, 1, 0)", "visible": false } ]
],
"view": "timeSeries",
"stacked": false,
"period": 60,
"region": "us-east-1"
}
此处显示所需的触发事件<11 >=23 UTC
这些时间的 CPU 利用率为 1%