Skip to content

Commit e589ef9

Browse files
[ECT-4454][prometheus] Add documentation for V2 webhook (DataDog#22453)
1 parent 785d277 commit e589ef9

1 file changed

Lines changed: 96 additions & 20 deletions

File tree

prometheus/README.md

Lines changed: 96 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ Note: Bucket data for a given `<HISTOGRAM_METRIC_NAME>` Prometheus histogram met
5656

5757
### Events
5858

59-
Prometheus Alertmanager alerts are automatically sent to your Datadog event stream following the webhook configuration.
59+
Prometheus Alertmanager alerts are automatically sent to your Datadog event stream following the webhook configuration. See the [Prometheus Alertmanager](#prometheus-alertmanager) section for setup instructions.
6060

6161
### Service Checks
6262

@@ -66,27 +66,101 @@ The Prometheus check does not include any service checks.
6666
Send Prometheus Alertmanager alerts in the event stream. Natively, Alertmanager sends all alerts simultaneously to the configured webhook. To see alerts in Datadog, you must configure your instance of Alertmanager to send alerts one at a time. You can add a group-by parameter under `route` to have alerts grouped by the actual name of the alert rule.
6767

6868
### Setup
69-
1. Edit the Alertmanager configuration file, `alertmanager.yml`, to include the following:
70-
```
71-
receivers:
72-
- name: datadog
73-
webhook_configs:
74-
- send_resolved: true
75-
url: https://app.datadoghq.com/intake/webhook/prometheus?api_key=<DATADOG_API_KEY>
76-
route:
77-
group_by: ['alertname']
78-
group_wait: 10s
79-
group_interval: 5m
80-
receiver: datadog
81-
repeat_interval: 3h
82-
```
83-
84-
**Note**: This endpoint accepts only one event in the payload at a time.
69+
70+
<!-- xxx tabs xxx -->
71+
<!-- xxx tab "V2 (preferred)" xxx -->
72+
73+
1. Edit the `alertmanager.yml` configuration file to include the following:
74+
75+
```yaml
76+
receivers:
77+
- name: datadog
78+
webhook_configs:
79+
- send_resolved: true
80+
url: https://event-management-intake.datadoghq.com/api/v2/events/webhook?dd-api-key=<DATADOG_API_KEY>&integration_id=prometheus
81+
route:
82+
group_by: ['alertname']
83+
group_wait: 10s
84+
group_interval: 5m
85+
receiver: datadog
86+
repeat_interval: 3h
87+
```
88+
89+
<div class="alert alert-info">
90+
<ul>
91+
<li> The <code>group_by</code> parameter determines how alerts are grouped together when sent to Datadog. Alerts with matching values for the specified labels are combined into a single notification. For details on routing configuration, see the <a href="https://prometheus.io/docs/alerting/latest/configuration/">Prometheus Alertmanager documentation</a>.</li>
92+
<li>This endpoint accepts only one event in the payload at a time.</li>
93+
</ul>
94+
</div>
95+
96+
2. (Optional) Use matchers to redirect specific alerts to different receivers. Matchers allow routing based on any alert label. For syntax details, see the [Alertmanager matcher documentation][12].
97+
98+
The V2 webhook supports additional query parameters. For example, use the `oncall_team` parameter to integrate with [Datadog On-Call][11] and redirect pages to different teams:
99+
100+
```yaml
101+
receivers:
102+
- name: datadog-ops
103+
webhook_configs:
104+
- send_resolved: true
105+
url: https://event-management-intake.datadoghq.com/api/v2/events/webhook?dd-api-key=<DATADOG_API_KEY>&integration_id=prometheus&oncall_team=ops
106+
- name: datadog-db
107+
webhook_configs:
108+
- send_resolved: true
109+
url: https://event-management-intake.datadoghq.com/api/v2/events/webhook?dd-api-key=<DATADOG_API_KEY>&integration_id=prometheus&oncall_team=database
110+
111+
route:
112+
group_by: ['alertname']
113+
group_wait: 10s
114+
group_interval: 5m
115+
receiver: datadog-ops
116+
repeat_interval: 3h
117+
routes:
118+
- matchers:
119+
- team="database"
120+
receiver: datadog-db
121+
```
122+
123+
<div class="alert alert-tip">
124+
Setting <code>send_resolved: true</code> (the default value) enables Alertmanager to send notifications when alerts are resolved in Prometheus. This is particularly important when using the <code>oncall_team</code> parameter to ensure that pages are marked as resolved. Note that resolved notifications may be delayed until the next <code>group_interval</code>.
125+
</div>
126+
127+
3. Restart the Prometheus and Alertmanager services.
128+
129+
```shell
130+
sudo systemctl restart prometheus.service alertmanager.service
131+
```
132+
133+
<!-- xxz tab xxx -->
134+
<!-- xxx tab "V1" xxx -->
135+
136+
1. Edit the `alertmanager.yml` configuration file to include the following:
137+
138+
```yaml
139+
receivers:
140+
- name: datadog
141+
webhook_configs:
142+
- send_resolved: true
143+
url: https://app.datadoghq.com/intake/webhook/prometheus?api_key=<DATADOG_API_KEY>
144+
route:
145+
group_by: ['alertname']
146+
group_wait: 10s
147+
group_interval: 5m
148+
receiver: datadog
149+
repeat_interval: 3h
150+
```
151+
152+
<div class="alert alert-info">
153+
This endpoint accepts only one event in the payload at a time.
154+
</div>
85155

86156
2. Restart the Prometheus and Alertmanager services.
87-
```
88-
sudo systemctl restart prometheus.service alertmanager.service
89-
```
157+
158+
```shell
159+
sudo systemctl restart prometheus.service alertmanager.service
160+
```
161+
162+
<!-- xxz tab xxx -->
163+
<!-- xxz tabs xxx -->
90164

91165
## Troubleshooting
92166

@@ -108,3 +182,5 @@ Need help? Contact [Datadog support][7].
108182
[8]: https://www.datadoghq.com/blog/monitor-prometheus-metrics
109183
[9]: https://docs.datadoghq.com/agent/prometheus/
110184
[10]: https://docs.datadoghq.com/developers/prometheus/
185+
[11]: https://docs.datadoghq.com/service_management/on-call/
186+
[12]: https://prometheus.io/docs/alerting/latest/configuration/#matcher

0 commit comments

Comments
 (0)