Skip to content

Commit 3394eef

Browse files
Merge pull request #75015 from eromanova97/OBSDOCS-952
OBSDOCS-952: Clarify openshift-monitoring namespace requirement for m…
2 parents 9422c55 + b60ef6a commit 3394eef

3 files changed

+38
-24
lines changed

modules/monitoring-creating-new-alerting-rules.adoc

Lines changed: 18 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ These alerting rules trigger alerts based on the values of chosen metrics.
2323
2424
.Procedure
2525

26-
. Create a new YAML configuration file named `example-alerting-rule.yaml` in the `openshift-monitoring` namespace.
26+
. Create a new YAML configuration file named `example-alerting-rule.yaml`.
2727

2828
. Add an `AlertingRule` resource to the YAML file.
2929
The following example creates a new alerting rule named `example`, similar to the default `Watchdog` alert:
@@ -34,24 +34,30 @@ apiVersion: monitoring.openshift.io/v1
3434
kind: AlertingRule
3535
metadata:
3636
name: example
37-
namespace: openshift-monitoring
37+
namespace: openshift-monitoring # <1>
3838
spec:
3939
groups:
4040
- name: example-rules
4141
rules:
42-
- alert: ExampleAlert # <1>
43-
for: 1m # <2>
44-
expr: vector(1) # <3>
42+
- alert: ExampleAlert # <2>
43+
for: 1m # <3>
44+
expr: vector(1) # <4>
4545
labels:
46-
severity: warning # <4>
46+
severity: warning # <5>
4747
annotations:
48-
message: This is an example alert. # <5>
48+
message: This is an example alert. # <6>
4949
----
50-
<1> The name of the alerting rule you want to create.
51-
<2> The duration for which the condition should be true before an alert is fired.
52-
<3> The PromQL query expression that defines the new rule.
53-
<4> The severity that alerting rule assigns to the alert.
54-
<5> The message associated with the alert.
50+
<1> Ensure that the namespace is `openshift-monitoring`.
51+
<2> The name of the alerting rule you want to create.
52+
<3> The duration for which the condition should be true before an alert is fired.
53+
<4> The PromQL query expression that defines the new rule.
54+
<5> The severity that alerting rule assigns to the alert.
55+
<6> The message associated with the alert.
56+
+
57+
[IMPORTANT]
58+
====
59+
You must create the `AlertingRule` object in the `openshift-monitoring` namespace. Otherwise, the alerting rule is not accepted.
60+
====
5561

5662
. Apply the configuration file to the cluster:
5763
+

modules/monitoring-managing-core-platform-alerting-rules.adoc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ For example, you can change the `severity` label for an alert from `warning` to
1818

1919
* New alerting rules must be based on the default {product-title} monitoring metrics.
2020
21+
* You must create the `AlertingRule` and `AlertRelabelConfig` objects in the `openshift-monitoring` namespace.
22+
2123
* You can only add and modify alerting rules. You cannot create new recording rules or modify existing recording rules.
2224
2325
* If you modify existing platform alerting rules by using an `AlertRelabelConfig` object, your modifications are not reflected in the Prometheus alerts API.

modules/monitoring-modifying-core-platform-alerting-rules.adoc

Lines changed: 18 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ For example, you can change the severity label of an alert, add a custom label,
1616
1717
.Procedure
1818

19-
. Create a new YAML configuration file named `example-modified-alerting-rule.yaml` in the `openshift-monitoring` namespace.
19+
. Create a new YAML configuration file named `example-modified-alerting-rule.yaml`.
2020

2121
. Add an `AlertRelabelConfig` resource to the YAML file.
2222
The following example modifies the `severity` setting to `critical` for the default platform `watchdog` alerting rule:
@@ -27,22 +27,28 @@ apiVersion: monitoring.openshift.io/v1
2727
kind: AlertRelabelConfig
2828
metadata:
2929
name: watchdog
30-
namespace: openshift-monitoring
30+
namespace: openshift-monitoring # <1>
3131
spec:
3232
configs:
33-
- sourceLabels: [alertname,severity] <1>
34-
regex: "Watchdog;none" <2>
35-
targetLabel: severity <3>
36-
replacement: critical <4>
37-
action: Replace <5>
33+
- sourceLabels: [alertname,severity] # <2>
34+
regex: "Watchdog;none" # <3>
35+
targetLabel: severity # <4>
36+
replacement: critical # <5>
37+
action: Replace # <6>
3838
----
39-
<1> The source labels for the values you want to modify.
40-
<2> The regular expression against which the value of `sourceLabels` is matched.
41-
<3> The target label of the value you want to modify.
42-
<4> The new value to replace the target label.
43-
<5> The relabel action that replaces the old value based on regex matching.
39+
<1> Ensure that the namespace is `openshift-monitoring`.
40+
<2> The source labels for the values you want to modify.
41+
<3> The regular expression against which the value of `sourceLabels` is matched.
42+
<4> The target label of the value you want to modify.
43+
<5> The new value to replace the target label.
44+
<6> The relabel action that replaces the old value based on regex matching.
4445
The default action is `Replace`.
4546
Other possible values are `Keep`, `Drop`, `HashMod`, `LabelMap`, `LabelDrop`, and `LabelKeep`.
47+
+
48+
[IMPORTANT]
49+
====
50+
You must create the `AlertRelabelConfig` object in the `openshift-monitoring` namespace. Otherwise, the alert label will not change.
51+
====
4652

4753
. Apply the configuration file to the cluster:
4854
+

0 commit comments

Comments
 (0)