我正在设置如下所示的监视器:
resource "datadog_monitor" "queue_size_critical" {
message = "High Priority"
name = "too many messages in queue"
query = "max(last_10m):max:aws.sqs.approximate_number_of_messages_visible{aws_account:<account>,queuename:<queuename>} > 10"
type = "metric alert"
tags = my_tags
thresholds = {
ok = 0
warning = 1
critical = 10
}
renotify_interval = 1440
}
我还有一个看起来像这样的小部件:
widget {
alert_value_definition {
alert_id = datadog_monitor.queue_size_critical.id
title = datadog_monitor.queue_size_critical.name
}
}
我想定义两种不同的消息,一种将在超过“警告”阈值时发送,另一种将在超过“严重”阈值时发送。
我该怎么做?
这正确吗?
resource "datadog_monitor" "queue_size_critical" {
message = "{{#is_alert}}High Priority{{/is_alert}}
{{#is_warning}}Low priority{{/is_warning}}
This gets sent every time, in every message."
name = "too many messages in queue"
query = bla bla bla
...etc...
}
答案 0 :(得分:2)
所有操作都在conditional logic variables的message
属性中进行。
例如,如果您将message
值定义为此...
{{#is_alert}}
High Priority @pagerduty
{{/is_alert}}
{{#is_warning}}
Medium Priority @slack-mychannel
{{/is_warning}}
You should reference [this dashboard](mydashboardlink) to see how bad this is and follow [these steps](myrunbook) to resolve the situation.
...然后...