如何解决指标数学警报:如何使用for_each表达式在动态块内循环指标?
我正在尝试创建可通过JSON配置的动态指标数学警报。
我正在用for_each表达式循环度量指标警报,因为这是一个循环中的循环。
以下是我要执行的操作的示例:
R is your typical 3x3 rotation matrix embedded in a 4x4 with 0,1 on the last line
v is a 3D vector with coordinates (x,y,z)
T is a 4x4 translation matrix,all zeroes except the last column where it has x,z,1
L is another 4x4 translation matrix,but now with q instead of v
L' is the inverse transformation of L
M = T * L * R * L'
这是示例JSON
resource "aws_cloudwatch_metric_alarm" "Percentage_Alert" {
for_each = var.percentage_error_details
locals { alarm_details = each.value }
alarm_name = "${terraform.workspace}-${each.key}"
comparison_operator = local.alarm_details["Comparison_Operator"]
evaluation_periods = "1"
threshold = local.alarm_details["Threshold"]
metric_query {
id = "e1"
expression = local.alarm_details["Expression"]
label = local.alarm_details["Label"]
return_data = "true"
}
dynamic "metric_query" {
for metric in each.value["Metrics"]{
id = metric.key
metric_name = metric.value
period = local.alarm_details["Period"]
stat = local.alarm_details["Statistic"]
namespace = local.full_namespace
unit = "Count"
}
}
}
这是我收到的错误消息:
{
"locals": {
"Name": {
"Name": "metric_math","Metrics": {
"m1": "Sucess","m2": "Failure"
},"Expression": "100*(m2/(m1+m2))","Threshold" : 1,"Period": 25,"Priority": "critical","Statistic": "Sum","Label": "label","Comparison_Operator": "GreaterThanOrEqualToThreshold"
}
}
}
任何帮助将不胜感激。
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。