Skip to content

Commit d7ac751

Browse files
committed
[ECT-4454][prometheus] Add documentation for V2 webhook
1 parent 8c6c226 commit d7ac751

File tree

1 file changed

+78
-3
lines changed

1 file changed

+78
-3
lines changed

prometheus/README.md

Lines changed: 78 additions & 3 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,8 +66,75 @@ 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+
70+
<!-- xxx tabs xxx -->
71+
<!-- xxx tab "V2 (preferred)" xxx -->
72+
6973
1. Edit the Alertmanager configuration file, `alertmanager.yml`, to include the following:
74+
75+
{{< highlight yaml "hl_lines=3-5" >}}
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+
{{< /highlight >}}
88+
89+
<div class="alert alert-info">
90+
The <code>group_by</code> parameter determines how alerts are grouped together when sent to Datadog. Alerts sharing the same values for the specified labels will be grouped into a single notification. For more details on routing configuration, see the <a href="https://prometheus.io/docs/alerting/latest/configuration/">Prometheus Alertmanager documentation</a>.
91+
</div>
92+
93+
**Note**: This endpoint accepts only one event in the payload at a time.
94+
95+
2. (Optional) Use matchers to redirect specific alerts to different receivers. Alertmanager supports matchers to route notifications based on any label. For more information on matcher syntax, see the [Alertmanager matcher documentation][13].
96+
97+
The V2 webhook supports [additional query parameters][11]. For example, use the `oncall_team` parameter to integrate with the [Datadog On-Call][12] product and redirect pages to different teams:
98+
99+
{{< highlight yaml "hl_lines=5 9 18-19" >}}
100+
receivers:
101+
- name: datadog-ops
102+
webhook_configs:
103+
- send_resolved: true
104+
url: https://event-management-intake.datadoghq.com/api/v2/events/webhook?dd-api-key=<DATADOG_API_KEY>&integration_id=prometheus&oncall_team=ops
105+
- name: datadog-db
106+
webhook_configs:
107+
- send_resolved: true
108+
url: https://event-management-intake.datadoghq.com/api/v2/events/webhook?dd-api-key=<DATADOG_API_KEY>&integration_id=prometheus&oncall_team=database
109+
110+
route:
111+
group_by: ['alertname']
112+
group_wait: 10s
113+
group_interval: 5m
114+
receiver: datadog-ops
115+
repeat_interval: 3h
116+
routes:
117+
- matchers:
118+
- team="database"
119+
receiver: datadog-db
120+
{{< /highlight >}}
121+
122+
<div class="alert alert-tip">
123+
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 pages are marked as resolved. Note that resolved notifications may take up to the next <code>group_interval</code> to be sent.
124+
</div>
125+
126+
3. Restart the Prometheus and Alertmanager services.
127+
128+
```shell
129+
sudo systemctl restart prometheus.service alertmanager.service
70130
```
131+
132+
<!-- xxz tab xxx -->
133+
<!-- xxx tab "V1" xxx -->
134+
135+
1. Edit the Alertmanager configuration file, `alertmanager.yml`, to include the following:
136+
137+
{{< highlight yaml "hl_lines=3-5" >}}
71138
receivers:
72139
- name: datadog
73140
webhook_configs:
@@ -79,15 +146,19 @@ route:
79146
group_interval: 5m
80147
receiver: datadog
81148
repeat_interval: 3h
82-
```
149+
{{< /highlight >}}
83150

84151
**Note**: This endpoint accepts only one event in the payload at a time.
85152

86153
2. Restart the Prometheus and Alertmanager services.
87-
```
154+
155+
```shell
88156
sudo systemctl restart prometheus.service alertmanager.service
89157
```
90158

159+
<!-- xxz tab xxx -->
160+
<!-- xxz tabs xxx -->
161+
91162
## Troubleshooting
92163

93164
Need help? Contact [Datadog support][7].
@@ -108,3 +179,7 @@ Need help? Contact [Datadog support][7].
108179
[8]: https://www.datadoghq.com/blog/monitor-prometheus-metrics
109180
[9]: https://docs.datadoghq.com/agent/prometheus/
110181
[10]: https://docs.datadoghq.com/developers/prometheus/
182+
[11]: https://docs.datadoghq.com/service_management/events/ingest/webhook
183+
[12]: https://docs.datadoghq.com/service_management/on-call/
184+
[13]: https://prometheus.io/docs/alerting/latest/configuration/#matcher
185+
[14]: https://prometheus.io/docs/alerting/latest/configuration/

0 commit comments

Comments
 (0)