Datadog how do i change a monitor to a single alert with no recovery
Asked Answered
P

2

12

So i currently have a monitor set up that sends an alert, but after 5 mins it also send a recovery alert. What i wanted to find out was is it possible to have a monitor that only sends the alert but no recovery alert.

I need a one off alert on error thats it.

Politick answered 11/4, 2023 at 10:6 Comment(0)
M
22

To extend onto draav's answer, your notification template should look like this when notification needs to be sent only in case of alert

{{#is_alert}}

This is my alert content!

@[email protected]
{{/is_alert}}

This approach can be further extended when we want to notify different users for different type of notifications.

Below example sends alert notification to [email protected] and recovery notification to [email protected].

{{#is_alert}}

Something went wrong!

@[email protected]
{{/is_alert}}

{{#is_alert_recovery}}

Things are back to normal!

@[email protected]
{{/is_alert_recovery}}
Merciful answered 5/5, 2023 at 17:27 Comment(0)
B
6

Put your message inside a conditional variable: https://docs.datadoghq.com/monitors/notify/variables/?tab=is_alert#conditional-variables

The message will only be sent on alert, and not for any other status changes

Bainite answered 11/4, 2023 at 11:54 Comment(2)
not sure how that would work. I just want the alert to be sent and then dont worry about the recovery alert.Politick
As in the example in the docs draav linked, putting your notification handle between{{#is_alert}} and {{/is_alert}} means that the notification only gets sent when the alert is triggering, not when it's recovering.Whaleboat

© 2022 - 2024 — McMap. All rights reserved.