Skip to content

Commit 10ced59

Browse files
authored
Merge pull request #79966 from eromanova97/OBSDOCS-63
OBSDOCS-63: Update info re supported Alertmanager configurations
2 parents db37f79 + ba081cb commit 10ced59

5 files changed

+168
-136
lines changed

modules/monitoring-applying-custom-alertmanager-configuration.adoc

Lines changed: 0 additions & 118 deletions
This file was deleted.
Lines changed: 133 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,133 @@
1+
// Module included in the following assemblies:
2+
//
3+
// * observability/monitoring/managing-alerts.adoc
4+
5+
:_mod-docs-content-type: PROCEDURE
6+
[id="configuring-notifications-for-default-platform-alerts_{context}"]
7+
= Configuring notifications for default platform alerts
8+
9+
You can configure Alertmanager to send notifications. Customize where and how Alertmanager sends notifications about default platform alerts by editing the default configuration in the `alertmanager-main` secret in the `openshift-monitoring` namespace.
10+
11+
[IMPORTANT]
12+
====
13+
Alertmanager does not send notifications by default. It is recommended to configure Alertmanager to receive notifications by setting up notifications details in the `alertmanager-main` secret configuration file.
14+
====
15+
16+
.Prerequisites
17+
18+
* You have access to the cluster as a user with the `cluster-admin` cluster role.
19+
20+
.Procedure
21+
22+
. Open the Alertmanager YAML configuration file:
23+
24+
** To open the Alertmanager configuration from the CLI:
25+
26+
.. Print the currently active Alertmanager configuration from the `alertmanager-main` secret into `alertmanager.yaml` file:
27+
+
28+
[source,terminal]
29+
----
30+
$ oc -n openshift-monitoring get secret alertmanager-main --template='{{ index .data "alertmanager.yaml" }}' | base64 --decode > alertmanager.yaml
31+
----
32+
33+
.. Open the `alertmanager.yaml` file.
34+
35+
** To open the Alertmanager configuration from the {product-title} web console:
36+
37+
.. Go to the *Administration* -> *Cluster Settings* -> *Configuration* -> *Alertmanager* -> *YAML* page of the web console.
38+
39+
. Edit the Alertmanager configuration by updating parameters in the YAML:
40+
+
41+
[source,yaml]
42+
----
43+
global:
44+
resolve_timeout: 5m
45+
route:
46+
group_wait: 30s #<1>
47+
group_interval: 5m #<2>
48+
repeat_interval: 12h #<3>
49+
receiver: default
50+
routes:
51+
- matchers:
52+
- "alertname=Watchdog"
53+
repeat_interval: 2m
54+
receiver: watchdog
55+
- matchers:
56+
- "service=<your_service>" #<4>
57+
routes:
58+
- matchers:
59+
- <your_matching_rules> #<5>
60+
receiver: <receiver> #<6>
61+
receivers:
62+
- name: default
63+
- name: watchdog
64+
- name: <receiver>
65+
<receiver_configuration> #<7>
66+
----
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.
70+
If you want a notification to repeat at each group interval, set the `repeat_interval` value to less than the `group_interval` value.
71+
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.
76+
+
77+
[IMPORTANT]
78+
====
79+
* Use the `matchers` key name to indicate the matchers that an alert has to fulfill to match the node.
80+
Do not use the `match` or `match_re` key names, which are both deprecated and planned for removal in a future release.
81+
82+
* If you define inhibition rules, use the following key names:
83+
+
84+
--
85+
** `target_matchers`: to indicate the target matchers
86+
** `source_matchers`: to indicate the source matchers
87+
--
88+
+
89+
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.
90+
====
91+
+
92+
The following Alertmanager configuration example configures PagerDuty as an alert receiver:
93+
+
94+
[source,yaml]
95+
----
96+
global:
97+
resolve_timeout: 5m
98+
route:
99+
group_wait: 30s
100+
group_interval: 5m
101+
repeat_interval: 12h
102+
receiver: default
103+
routes:
104+
- matchers:
105+
- "alertname=Watchdog"
106+
repeat_interval: 2m
107+
receiver: watchdog
108+
- matchers:
109+
- "service=example-app"
110+
routes:
111+
- matchers:
112+
- "severity=critical"
113+
receiver: team-frontend-page
114+
receivers:
115+
- name: default
116+
- name: watchdog
117+
- name: team-frontend-page
118+
pagerduty_configs:
119+
- service_key: "<your_key>"
120+
----
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.
123+
124+
. Apply the new configuration in the file:
125+
126+
** To apply the changes from the CLI, run the following command:
127+
+
128+
[source,terminal]
129+
----
130+
$ oc -n openshift-monitoring create secret generic alertmanager-main --from-file=alertmanager.yaml --dry-run=client -o=yaml | oc -n openshift-monitoring replace secret --filename=-
131+
----
132+
133+
** To apply the changes from the {product-title} web console, click *Save*.
Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@
33
// * observability/monitoring/managing-alerts.adoc
44

55
:_mod-docs-content-type: PROCEDURE
6-
[id="applying-a-custom-configuration-to-alertmanager-for-user-defined-alert-routing_{context}"]
7-
= Applying a custom configuration to Alertmanager for user-defined alert routing
6+
[id="configuring-notifications-for-user-defined-alerts_{context}"]
7+
= Configuring notifications for user-defined alerts
88

9-
If you have enabled a separate instance of Alertmanager dedicated to user-defined alert routing, you can overwrite the configuration for this instance of Alertmanager by editing the `alertmanager-user-workload` secret in the `openshift-user-workload-monitoring` namespace.
9+
If you have enabled a separate instance of Alertmanager that is dedicated to user-defined alert routing, you can customize where and how the instance sends notifications by editing the `alertmanager-user-workload` secret in the `openshift-user-workload-monitoring` namespace.
1010

1111
.Prerequisites
1212

@@ -37,15 +37,16 @@ route:
3737
- name: Default
3838
routes:
3939
- matchers:
40-
- "service = prometheus-example-monitor" <1>
41-
receiver: <receiver> <2>
40+
- "service = prometheus-example-monitor" #<1>
41+
receiver: <receiver> #<2>
4242
receivers:
4343
- name: Default
4444
- name: <receiver>
45-
# <receiver_configuration>
45+
<receiver_configuration> #<3>
4646
----
47-
<1> Specifies which alerts match the route. This example shows all alerts that have the `service="prometheus-example-monitor"` label.
48-
<2> Specifies the receiver to use for the alerts group.
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.
4950
+
5051
. Apply the new configuration in the file:
5152
+

observability/monitoring/common-monitoring-configuration-scenarios.adoc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ Any other configuration options listed here are optional.
2828

2929
* xref:../../observability/monitoring/configuring-the-monitoring-stack.adoc#creating-cluster-monitoring-configmap_configuring-the-monitoring-stack[Create the `cluster-monitoring-config` `ConfigMap` object] if it does not exist.
3030
* xref:../../observability/monitoring/managing-alerts.adoc#sending-notifications-to-external-systems_managing-alerts[Configure alert receivers] so that Alertmanager can send alerts to an external notification system such as email, Slack, or PagerDuty.
31+
* xref:../../observability/monitoring/managing-alerts.adoc#configuring-notifications-for-default-platform-alerts_managing-alerts[Configure notifications for default platform alerts].
3132
* For shorter term data retention, xref:../../observability/monitoring/configuring-the-monitoring-stack.adoc#configuring-persistent-storage_configuring-the-monitoring-stack[configure persistent storage] for Prometheus and Alertmanager to store metrics and alert data.
3233
Specify the metrics data retention parameters for Prometheus and Thanos Ruler.
3334
+
@@ -70,7 +71,7 @@ Cluster administrators typically complete the following activities to configure
7071
* xref:../../observability/monitoring/enabling-alert-routing-for-user-defined-projects.adoc#enabling-alert-routing-for-user-defined-projects[Enable alert routing for user-defined projects] so that developers and other users can configure custom alerts and alert routing for their projects.
7172
* If needed, configure alert routing for user-defined projects to xref:../../observability/monitoring/enabling-alert-routing-for-user-defined-projects.adoc#enabling-a-separate-alertmanager-instance-for-user-defined-alert-routing_enabling-alert-routing-for-user-defined-projects[use an optional Alertmanager instance dedicated for use only by user-defined projects].
7273
* xref:../../observability/monitoring/managing-alerts.adoc#configuring-different-alert-receivers-for-default-platform-alerts-and-user-defined-alerts_managing-alerts[Configure alert receivers] for user-defined projects.
73-
* xref:../../observability/monitoring/managing-alerts.adoc#applying-a-custom-configuration-to-alertmanager-for-user-defined-alert-routing_managing-alerts[Apply a custom configuration to Alertmanager for user-defined alert routing].
74+
* xref:../../observability/monitoring/managing-alerts.adoc#configuring-notifications-for-user-defined-alerts_managing-alerts[Configure notifications for user-defined alerts].
7475

7576
After monitoring for user-defined projects is enabled and configured, developers and other non-administrator users can then perform the following activities to set up and use monitoring for their own projects:
7677

observability/monitoring/managing-alerts.adoc

Lines changed: 24 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -101,20 +101,35 @@ include::modules/monitoring-configuring-different-alert-receivers-for-default-pl
101101
// Creating alert routing for user-defined projects
102102
include::modules/monitoring-creating-alert-routing-for-user-defined-projects.adoc[leveloffset=+2]
103103
104-
// Applying a custom Alertmanager configuration
104+
[id="configuring-alertmanager-to-send-notifications"]
105+
== Configuring Alertmanager to send notifications
106+
107+
You can configure Alertmanager to send notifications by editing the
105108
ifndef::openshift-dedicated,openshift-rosa[]
106-
include::modules/monitoring-applying-custom-alertmanager-configuration.adoc[leveloffset=+1]
109+
`alertmanager-main` secret for default platform alerts or
107110
endif::openshift-dedicated,openshift-rosa[]
111+
`alertmanager-user-workload` secret for user-defined alerts.
108112
109-
// Applying a custom configuration to Alertmanager for user-defined alert routing
110-
include::modules/monitoring-applying-a-custom-configuration-to-alertmanager-for-user-defined-alert-routing.adoc[leveloffset=+1]
113+
[NOTE]
114+
====
115+
All features of a supported version of upstream Alertmanager are also supported in an OpenShift Alertmanager configuration. To check all the configuration options of a supported version of upstream Alertmanager, see link:https://prometheus.io/docs/alerting/0.26/configuration/[Alertmanager configuration].
116+
====
117+
118+
// Configuring notifications for default platform alerts
119+
ifndef::openshift-dedicated,openshift-rosa[]
120+
include::modules/monitoring-configuring-notifications-for-default-platform-alerts.adoc[leveloffset=+2]
121+
endif::openshift-dedicated,openshift-rosa[]
122+
123+
// Configuring notifications for user-defined alerts
124+
include::modules/monitoring-configuring-notifications-for-user-defined-alerts.adoc[leveloffset=+2]
111125
112126
[role="_additional-resources"]
113-
.Additional resources
127+
[id="additional-resources_configuring-alertmanager-to-send-notifications"]
128+
== Additional resources
114129
115-
* See link:https://www.pagerduty.com/[the PagerDuty official site] for more information on PagerDuty.
116-
* See link:https://www.pagerduty.com/docs/guides/prometheus-integration-guide/[the PagerDuty Prometheus Integration Guide] to learn how to retrieve the `service_key`.
117-
* See link:https://prometheus.io/docs/alerting/configuration/[Alertmanager configuration] for configuring alerting through different alert receivers.
130+
* link:https://www.pagerduty.com/[PagerDuty official site]
131+
* link:https://www.pagerduty.com/docs/guides/prometheus-integration-guide/[PagerDuty Prometheus Integration Guide]
132+
* xref:../../observability/monitoring/configuring-the-monitoring-stack.adoc#support-version-matrix-for-monitoring-components_configuring-the-monitoring-stack[Support version matrix for monitoring components]
118133
ifndef::openshift-rosa,openshift-dedicated[]
119-
* See xref:../../observability/monitoring/enabling-alert-routing-for-user-defined-projects.adoc#enabling-alert-routing-for-user-defined-projects[Enabling alert routing for user-defined projects] to learn how to enable a dedicated instance of Alertmanager for user-defined alert routing.
134+
* xref:../../observability/monitoring/enabling-alert-routing-for-user-defined-projects.adoc#enabling-alert-routing-for-user-defined-projects[Enabling alert routing for user-defined projects]
120135
endif::[]

0 commit comments

Comments
 (0)