How do I setup conditional contacts and messages in a single monitor?

Datadog monitors allow for different text to be sent to different contacts based on the state of the monitor and the details of how it was triggered.

Message template variables provide this kind of conditional processing and are described within the help text in section 3 of the monitor edit page shown below:

 

These condition variables can be used within either the subject or body of the notification set in section 3 of the monitor definition.

The example above shows how to set the message text based on the monitor state. The first line captures an alert state {{#is_alert}} and the second captures a clearing (or not alert) {{^is_alert}} state. 

Users may also want to send alarms to additional or different contacts or channels based on the name of the system that the monitor was triggered from. 

The example below shows how to use the is_match variable to send the notification to specific contacts based on the value of a host tag named "customer":

{{#is_match "host.customer" "customer1"}} alert for customer 1 on {{host.name}}  @slack-customer1  {{/is_match}}  


{{#is_match "host.customer" "customer2"}} alert for customer2 on  {{host.name}} @slack-customer2  {{/is_match}} 

Keep in mind when using conditional tags that they must have an open (example: {{#is_alert}}) and closing (example: {{/is_alert}}) pair with the desired text and @ mentions in between.

Have more questions? Submit a request

0 Comments

Please sign in to leave a comment.
Powered by Zendesk