Skip to content

Commit f2ce213

Browse files
authored
Merge pull request #85113 from eromanova97/OBSDOCS-181
OBSDOCS-181: Alertmanager should use the proxy environment variables
2 parents 5c38745 + 48956aa commit f2ce213

File tree

2 files changed

+37
-25
lines changed

2 files changed

+37
-25
lines changed

modules/monitoring-configuring-notifications-for-default-platform-alerts.adoc

Lines changed: 27 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -42,37 +42,40 @@ $ oc -n openshift-monitoring get secret alertmanager-main --template='{{ index .
4242
----
4343
global:
4444
resolve_timeout: 5m
45+
http_config:
46+
proxy_from_environment: true # <1>
4547
route:
46-
group_wait: 30s #<1>
47-
group_interval: 5m #<2>
48-
repeat_interval: 12h #<3>
48+
group_wait: 30s # <2>
49+
group_interval: 5m # <3>
50+
repeat_interval: 12h # <4>
4951
receiver: default
5052
routes:
5153
- matchers:
5254
- "alertname=Watchdog"
5355
repeat_interval: 2m
5456
receiver: watchdog
5557
- matchers:
56-
- "service=<your_service>" #<4>
58+
- "service=<your_service>" # <5>
5759
routes:
5860
- matchers:
59-
- <your_matching_rules> #<5>
60-
receiver: <receiver> #<6>
61+
- <your_matching_rules> # <6>
62+
receiver: <receiver> # <7>
6163
receivers:
6264
- name: default
6365
- name: watchdog
6466
- name: <receiver>
65-
<receiver_configuration> #<7>
67+
<receiver_configuration> # <8>
6668
----
67-
<1> Specify how long Alertmanager waits while collecting initial alerts for a group of alerts before sending a notification.
68-
<2> Specify how much time must elapse before Alertmanager sends a notification about new alerts added to a group of alerts for which an initial notification was already sent.
69-
<3> Specify the minimum amount of time that must pass before an alert notification is repeated.
69+
<1> If you configured an HTTP cluster-wide proxy, set the `proxy_from_environment` parameter to `true` to enable proxying for all alert receivers.
70+
<2> Specify how long Alertmanager waits while collecting initial alerts for a group of alerts before sending a notification.
71+
<3> Specify how much time must elapse before Alertmanager sends a notification about new alerts added to a group of alerts for which an initial notification was already sent.
72+
<4> Specify the minimum amount of time that must pass before an alert notification is repeated.
7073
If you want a notification to repeat at each group interval, set the `repeat_interval` value to less than the `group_interval` value.
7174
The repeated notification can still be delayed, for example, when certain Alertmanager pods are restarted or rescheduled.
72-
<4> Specify the name of the service that fires the alerts.
73-
<5> Specify labels to match your alerts.
74-
<6> Specify the name of the receiver to use for the alerts.
75-
<7> Specify the receiver configuration.
75+
<5> Specify the name of the service that fires the alerts.
76+
<6> Specify labels to match your alerts.
77+
<7> Specify the name of the receiver to use for the alerts.
78+
<8> Specify the receiver configuration.
7679
+
7780
[IMPORTANT]
7881
====
@@ -89,12 +92,13 @@ Do not use the `match` or `match_re` key names, which are both deprecated and pl
8992
Do not use the `target_match`, `target_match_re`, `source_match`, or `source_match_re` key names, which are deprecated and planned for removal in a future release.
9093
====
9194
+
92-
The following Alertmanager configuration example configures PagerDuty as an alert receiver:
93-
+
95+
.Example of Alertmanager configuration with PagerDuty as an alert receiver
9496
[source,yaml]
9597
----
9698
global:
9799
resolve_timeout: 5m
100+
http_config:
101+
proxy_from_environment: true
98102
route:
99103
group_wait: 30s
100104
group_interval: 5m
@@ -105,7 +109,7 @@ route:
105109
- "alertname=Watchdog"
106110
repeat_interval: 2m
107111
receiver: watchdog
108-
- matchers:
112+
- matchers: # <1>
109113
- "service=example-app"
110114
routes:
111115
- matchers:
@@ -117,9 +121,13 @@ receivers:
117121
- name: team-frontend-page
118122
pagerduty_configs:
119123
- service_key: "<your_key>"
124+
http_config: # <2>
125+
proxy_from_environment: true
126+
authorization:
127+
credentials: xxxxxxxxxx
120128
----
121-
+
122-
With this configuration, alerts of `critical` severity that are fired by the `example-app` service are sent through the `team-frontend-page` receiver. Typically, these types of alerts would be paged to an individual or a critical response team.
129+
<1> Alerts of `critical` severity that are fired by the `example-app` service are sent through the `team-frontend-page` receiver. Typically, these types of alerts would be paged to an individual or a critical response team.
130+
<2> Custom HTTP configuration for a specific receiver. If you configure the custom HTTP configuration for a specific alert receiver, that receiver does not inherit the global HTTP config settings.
123131
124132
. Apply the new configuration in the file:
125133

modules/monitoring-configuring-notifications-for-user-defined-alerts.adoc

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,22 +31,26 @@ $ oc -n openshift-user-workload-monitoring get secret alertmanager-user-workload
3131
+
3232
[source,yaml]
3333
----
34+
global:
35+
http_config:
36+
proxy_from_environment: true # <1>
3437
route:
3538
receiver: Default
3639
group_by:
3740
- name: Default
3841
routes:
3942
- matchers:
40-
- "service = prometheus-example-monitor" #<1>
41-
receiver: <receiver> #<2>
43+
- "service = prometheus-example-monitor" # <2>
44+
receiver: <receiver> # <3>
4245
receivers:
4346
- name: Default
4447
- name: <receiver>
45-
<receiver_configuration> #<3>
48+
<receiver_configuration> # <4>
4649
----
47-
<1> Specify labels to match your alerts. This example targets all alerts that have the `service="prometheus-example-monitor"` label.
48-
<2> Specify the name of the receiver to use for the alerts group.
49-
<3> Specify the receiver configuration.
50+
<1> If you configured an HTTP cluster-wide proxy, set the `proxy_from_environment` parameter to `true` to enable proxying for all alert receivers.
51+
<2> Specify labels to match your alerts. This example targets all alerts that have the `service="prometheus-example-monitor"` label.
52+
<3> Specify the name of the receiver to use for the alerts group.
53+
<4> Specify the receiver configuration.
5054
+
5155
. Apply the new configuration in the file:
5256
+

0 commit comments

Comments
 (0)