Datadog新事件API迁移失败
我正在将我们的DataDog监视器之一从event Alert
升级到event-v2警报
以下此迁移指南。我们的监视器是使用Datadog Terraform提供商创建的。
当前监视器使用事件警报
类型:
resource "datadog_monitor" "guardduty_high_severity_findings" {
name = "[tf] [${terraform.workspace}] AWS Guardduty Reporting High Severity Findings"
type = "event alert"
message = <<EOT
Some custom message
EOT
escalation_message = <<EOT
<nil>
EOT
tags = ["system:ops", "service:aws"]
query = "events('sources:sns priority:all').rollup('count').last('xm') > 0"
notify_no_data = false
no_data_timeframe = 0
renotify_interval = 0
notify_audit = false
timeout_h = 0
include_tags = true
}
此监视器在检测到AWS GuardDuty事件后,该监视器按预期工作,DataDog警报将触发。
使用event-v2警报
类型的迁移监视器:
resource "datadog_monitor" "guardduty_high_severity_findings" {
name = "[tf] [${terraform.workspace}] AWS Guardduty Reporting High Severity Findings"
type = "event-v2 alert"
message = <<EOT
Some custom message
EOT
escalation_message = <<EOT
<nil>
EOT
tags = ["system:ops", "service:aws"]
query = "events('sources:amazon_sns').rollup('count').last('xm') > 0"
notify_no_data = false
no_data_timeframe = 0
renotify_interval = 0
notify_audit = false
timeout_h = 0
include_tags = true
}
但是,在执行Terraform计划时,这会出现错误,称该请求由于无效的查询格式而被DataDog拒绝。
$ terraform plan
...
Error: error validating monitor from https://api.datadoghq.com/api/v1/monitor/validate: 400 Bad Request: {"errors": ["The value provided for parameter 'query' is invalid: invalid operator specified: "]}
with datadog_monitor.guardduty_high_severity_findings,
on monitors-static.tf line 106, in resource "datadog_monitor" "guardduty_high_severity_findings":
106: resource "datadog_monitor" "guardduty_high_severity_findings" {
感谢是否有人可以帮助弄清楚这里的问题。
I'm upgrading one of our datadog monitors from event alert
to event-v2 alert
following this migration guide. Our monitors are created using Datadog Terraform provider.
Current monitor using event alert
type:
resource "datadog_monitor" "guardduty_high_severity_findings" {
name = "[tf] [${terraform.workspace}] AWS Guardduty Reporting High Severity Findings"
type = "event alert"
message = <<EOT
Some custom message
EOT
escalation_message = <<EOT
<nil>
EOT
tags = ["system:ops", "service:aws"]
query = "events('sources:sns priority:all').rollup('count').last('xm') > 0"
notify_no_data = false
no_data_timeframe = 0
renotify_interval = 0
notify_audit = false
timeout_h = 0
include_tags = true
}
This monitor works as expected and Datadog alerts get triggered once AWS GuardDuty incident is detected.
Migrated monitor using event-v2 alert
type:
resource "datadog_monitor" "guardduty_high_severity_findings" {
name = "[tf] [${terraform.workspace}] AWS Guardduty Reporting High Severity Findings"
type = "event-v2 alert"
message = <<EOT
Some custom message
EOT
escalation_message = <<EOT
<nil>
EOT
tags = ["system:ops", "service:aws"]
query = "events('sources:amazon_sns').rollup('count').last('xm') > 0"
notify_no_data = false
no_data_timeframe = 0
renotify_interval = 0
notify_audit = false
timeout_h = 0
include_tags = true
}
However, this gives an error when performing a terraform plan saying that the request has been rejected by DataDog due to invalid query format.
$ terraform plan
...
Error: error validating monitor from https://api.datadoghq.com/api/v1/monitor/validate: 400 Bad Request: {"errors": ["The value provided for parameter 'query' is invalid: invalid operator specified: "]}
with datadog_monitor.guardduty_high_severity_findings,
on monitors-static.tf line 106, in resource "datadog_monitor" "guardduty_high_severity_findings":
106: resource "datadog_monitor" "guardduty_high_severity_findings" {
Appreciate if anyone could help with figuring out what's wrong here.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我发现了同样的问题,似乎新类型
event-v2警报
不再支持query
param中的单个引号。我们需要到处使用双重报价(另外需要逃脱)。示例:
“ events(\”源:Amazon_SNS \“)。汇总(\“ count \”)。last(\“ xm \”)&gt; 0“”
好奇地,支持迁移doc doc do do dion'提到这种破裂的变化。
I found the same issue and it seems that the new type
event-v2 alert
doesn't support single quotes in thequery
param anymore. We need to use double quotes everywhere (plus need to escape them).Example:
"events(\"sources:amazon_sns\").rollup(\"count\").last(\"xm\") > 0"
Curiously, the support migration doc doesn't mention this breaking change.