[Datadog] I want to trigger alerts to different channels based on conditions when configuring a Monitor.

Print

When configuring a monitor, you can apply different messages and alert propagation channels for each condition by using conditional variables in the “Notify your team” section.

Conditional Variables

These allow certain text to be displayed based on specified conditions. 

{{#is_alert}}

발생한 알람이 ALERT입니다.

{{^is_alert}}

발생한 알람이 ALERT이 아닙니다.

{{#is_match}}

컨텍스트가 제공된 하위 문자열과 일치합니다.

{{^is_match}}

컨텍스트가 제공된 하위 문자열과 일치하지 않습니다.

{{#is_exact_match}}

컨텍스트가 제공된 문자열과 정확히 일치합니다.

{{^is_exact_match}}

컨텍스트가 제공된 문자열과 정확히 일치하지 않습니다.

{{#is_no_data}}

발생한 알람이 NO DATA입니다.

{{^is_no_data}}

발생한 알람이 NO DATA가 아닙니다.

{{#is_warning}}

발생한 알람이 WARNING입니다.

{{^is_warning}}

발생한 알람이 WARNING이 아닙니다.

{{#is_recovery}}

발생한 알람이 ALERT, WARNING또는 NO DATA 에서 복구 알람입니다.

{{^is_recovery}}

발생한 알람이 ALERT, WARNING또는 NO DATA 에서 복구 알람이 아닙니다.

{{#is_warning_recovery}}

발생한 알람이 WARNING복구 알람입니다.

{{^is_warning_recovery}}

발생한 알람이 WARNING복구 알람이 아닙니다.

{{#is_alert_recovery}}

발생한 알람이 ALERT복구 알람입니다.

{{^is_alert_recovery}}

발생한 알람이 ALERT복구 알람이 아닙니다.

{{#is_alert_to_warning}}

발생한 알람이 ALERT에서 WARNING 으로 전환 알람입니다.

{{^is_alert_to_warning}}

발생한 알람이 ALERT에서 WARNING 으로 전환 알람이 아닙니다.

{{#is_no_data_recovery}}

발생한 알람이 NO DATA복구 알람입니다.

{{^is_no_data_recovery}}

발생한 알람이 NO DATA복구 알람이 아닙니다.

{{#is_priority 'value'}}

모니터에 설정된 priority가 value 입니다. ( P1 to P5 )

{{#is_unknown}}

모니터가 알 수 없는 상태입니다.

{{^is_unknown}}

모니터가 알 수 없는 상태가 아닙니다.

{{#is_renotify}}

모니터가 다시 알림 중입니다.

{{^is_renotify}}

모니터가 다시 알리지 않습니다.


If you want to configure different propagation channels and messages based on a specific tag value,
it is recommended to create a new monitor or clone an existing one for each propagation channel, and create monitors per system individually.

Using multiple propagation channels in a single monitor may lead to different owners or management channels overseeing one monitor,
which requires alignment on common conditions such as thresholds.
Also, incorrect changes could affect multiple channels simultaneously.
For this reason, the method below should be used minimally and only when management is not an issue.

To apply conditions in the “Notify your team” message field,
you can use the following conditional variables from the list shown above:

  • {{#is_match "변수" "value1" "value2" }}{{/is_match}}

: Applies when the value of a specific variable contains the defined values. 

  • {{^is_match "변수" "value1" "value2" }}{{/is_match}}  

: Applies when the value of a specific variable does not contain the defined values. 

  • {{#is_exact_match "변수" "value1" "value2" }}{{/is_exact_match}} 

: Applies when the value of a specific variable exactly matches the defined values. 

  • {{^is_exact_match "변수" "value1" "value2" }} {{/is_exact_match}}  

: Applies when the value of a specific variable does not exactly match the defined values. 


You can define multiple strings for a single variable (applied as an OR condition).
Example: {{#is_match "host.env" "dev" "stg" }} This applies when the value of host.env is either dev or stg, and you can define messages or channels accordingly.  {{/is_match}} You can use conditional variables just like if/else statements in programming.
(Both of the following patterns are valid.)

{{#is_match  "host.env" "prod"}}
    @채널_prod
{{else}}
    @채널_dev
{{/is_match}}
{{#is_match  "host.service" "zmon" "slack"}}
    @채널_zmon
{{else}}
    {{#is_match  "host.service" "datadog"}}
        @채널_datadog
    {{else}}
        @채널_etc
    {{/is_match}}
{{/is_match}}

Did you find it helpful? Yes No

Send feedback
Sorry we couldn't be helpful. Help us improve this article with your feedback.