Skip to content

Commit 36c27b2

Browse files
authored
Merge pull request #73862 from eromanova97/OBSDOCS-158
OBSDOCS-158: Add severity and alert message in docs alerting rule exa…
2 parents 407ff64 + 5427ac1 commit 36c27b2

File tree

2 files changed

+31
-14
lines changed

2 files changed

+31
-14
lines changed

modules/monitoring-creating-alerting-rules-for-user-defined-projects.adoc

Lines changed: 19 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,13 @@
88

99
You can create alerting rules for user-defined projects. Those alerting rules will trigger alerts based on the values of the chosen metrics.
1010

11+
[NOTE]
12+
====
13+
* When you create an alerting rule, a project label is enforced on it even if a rule with the same name exists in another project.
14+
15+
* To help users understand the impact and cause of the alert, ensure that your alerting rule contains an alert message and severity value.
16+
====
17+
1118
.Prerequisites
1219

1320
* You have enabled monitoring for user-defined projects.
@@ -18,12 +25,8 @@ You can create alerting rules for user-defined projects. Those alerting rules wi
1825

1926
. Create a YAML file for alerting rules. In this example, it is called `example-app-alerting-rule.yaml`.
2027

21-
. Add an alerting rule configuration to the YAML file. For example:
22-
+
23-
[NOTE]
24-
====
25-
When you create an alerting rule, a project label is enforced on it if a rule with the same name exists in another project.
26-
====
28+
. Add an alerting rule configuration to the YAML file.
29+
The following example creates a new alerting rule named `example-alert`. The alerting rule fires an alert when the `version` metric exposed by the sample service becomes `0`:
2730
+
2831
[source,yaml]
2932
----
@@ -36,11 +39,17 @@ spec:
3639
groups:
3740
- name: example
3841
rules:
39-
- alert: VersionAlert
40-
expr: version{job="prometheus-example-app"} == 0
42+
- alert: VersionAlert # <1>
43+
expr: version{job="prometheus-example-app"} == 0 # <2>
44+
labels:
45+
severity: warning # <3>
46+
annotations:
47+
message: This is an example alert. # <4>
4148
----
42-
+
43-
This configuration creates an alerting rule named `example-alert`. The alerting rule fires an alert when the `version` metric exposed by the sample service becomes `0`.
49+
<1> The name of the alerting rule you want to create.
50+
<2> The PromQL query expression that defines the new rule.
51+
<3> The severity assigned to the alert.
52+
<4> The message associated with the alert.
4453

4554
. Apply the configuration file to the cluster:
4655
+

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

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,9 @@ These alerting rules trigger alerts based on the values of chosen metrics.
1111

1212
[NOTE]
1313
====
14-
If you create a customized `AlertingRule` resource based on an existing platform alerting rule, silence the original alert to avoid receiving conflicting alerts.
14+
* If you create a customized `AlertingRule` resource based on an existing platform alerting rule, silence the original alert to avoid receiving conflicting alerts.
15+
16+
* To help users understand the impact and cause of the alert, ensure that your alerting rule contains an alert message and severity value.
1517
====
1618

1719
.Prerequisites
@@ -24,7 +26,7 @@ If you create a customized `AlertingRule` resource based on an existing platform
2426
. Create a new YAML configuration file named `example-alerting-rule.yaml` in the `openshift-monitoring` namespace.
2527

2628
. Add an `AlertingRule` resource to the YAML file.
27-
The following example creates a new alerting rule named `example`, similar to the default `watchdog` alert:
29+
The following example creates a new alerting rule named `example`, similar to the default `Watchdog` alert:
2830
+
2931
[source,yaml]
3032
----
@@ -37,11 +39,17 @@ spec:
3739
groups:
3840
- name: example-rules
3941
rules:
40-
- alert: ExampleAlert <1>
41-
expr: vector(1) <2>
42+
- alert: ExampleAlert # <1>
43+
expr: vector(1) # <2>
44+
labels:
45+
severity: warning # <3>
46+
annotations:
47+
message: This is an example alert. # <4>
4248
----
4349
<1> The name of the alerting rule you want to create.
4450
<2> The PromQL query expression that defines the new rule.
51+
<3> The severity assigned to the alert.
52+
<4> The message associated with the alert.
4553

4654
. Apply the configuration file to the cluster:
4755
+

0 commit comments

Comments
 (0)