|
6 | 6 | [id="creating-cross-project-alerting-rules-for-user-defined-projects_{context}"]
|
7 | 7 | = Creating cross-project alerting rules for user-defined projects
|
8 | 8 |
|
9 |
| -You can create alerting rules for user-defined projects that are not bound to their project of origin by configuring a project in the `user-workload-monitoring-config` config map. This allows you to create generic alerting rules that get applied to multiple user-defined projects instead of having individual `PrometheusRule` objects in each user project. |
| 9 | +You can create alerting rules that are not bound to their project of origin by configuring a project in the `user-workload-monitoring-config` config map. The `PrometheusRule` objects created in these projects are then applicable to all projects. |
| 10 | + |
| 11 | +Therefore, you can have generic alerting rules that apply to multiple user-defined projects instead of having individual `PrometheusRule` objects in each user project. You can filter which projects are included or excluded from the alerting rule by using PromQL queries in the `PrometheusRule` object. |
10 | 12 |
|
11 | 13 | .Prerequisites
|
12 | 14 |
|
@@ -48,10 +50,10 @@ metadata:
|
48 | 50 | namespace: openshift-user-workload-monitoring
|
49 | 51 | data:
|
50 | 52 | config.yaml: |
|
51 |
| - namespacesWithoutLabelEnforcement: [ <namespace> ] # <1> |
| 53 | + namespacesWithoutLabelEnforcement: [ <namespace1>, <namespace2> ] # <1> |
52 | 54 | # ...
|
53 | 55 | ----
|
54 |
| -<1> Specify one or more projects in which you want to create cross-project alerting rules. Prometheus and Thanos Ruler for user-defined monitoring do not enforce the `namespace` label in `PrometheusRule` objects created in these projects. |
| 56 | +<1> Specify one or more projects in which you want to create cross-project alerting rules. Prometheus and Thanos Ruler for user-defined monitoring do not enforce the `namespace` label in `PrometheusRule` objects created in these projects, making the `PrometheusRule` objects applicable to all projects. |
55 | 57 |
|
56 | 58 | . Create a YAML file for alerting rules. In this example, it is called `example-cross-project-alerting-rule.yaml`.
|
57 | 59 |
|
|
81 | 83 | <1> Ensure that you specify the project that you defined in the `namespacesWithoutLabelEnforcement` field.
|
82 | 84 | <2> The name of the alerting rule you want to create.
|
83 | 85 | <3> The duration for which the condition should be true before an alert is fired.
|
84 |
| -<4> The PromQL query expression that defines the new rule. |
| 86 | +<4> The PromQL query expression that defines the new rule. You can use label matchers on the `namespace` label to filter which projects are included or excluded from the alerting rule. |
85 | 87 | <5> The message associated with the alert.
|
86 | 88 | <6> The severity that alerting rule assigns to the alert.
|
87 | 89 | +
|
|
0 commit comments