Skip to content

Commit 23a4704

Browse files
committed
Clarify platform alerting
Signed-off-by: Simon Pasquier <[email protected]>
1 parent 4ad7294 commit 23a4704

File tree

2 files changed

+31
-4
lines changed

2 files changed

+31
-4
lines changed

content/Products/OpenshiftMonitoring/alerting.md

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,41 @@
44

55
This document is intended for OpenShift developers that want to write alerting rules for their operators and operands.
66

7+
## Configuring alerting rules
8+
9+
You configure alerting rules based on the metrics being collected for your component(s). To do so, you should create `PrometheusRule` objects in your operator/operand namespace which will also be picked up by the Prometheus operator (provided that the namespace has the `openshift.io/cluster-monitoring="true"` label for layered operators).
10+
11+
Here is an example of a PrometheusRule object with a single alerting rule:
12+
13+
```yaml
14+
apiVersion: monitoring.coreos.com/v1
15+
kind: PrometheusRule
16+
metadata:
17+
name: cluster-example-operator-rules
18+
namespace: openshift-example-operator
19+
spec:
20+
groups:
21+
- name: operator
22+
rules:
23+
- alert: ClusterExampleOperatorUnhealthy
24+
annotations:
25+
description: Cluster Example operator running in pod {{$labels.namespace}}/{{$labels.pods}} is not healthy.
26+
summary: Operator Example not healthy
27+
expr: |
28+
max by(pod, namespace) (last_over_time(example_operator_healthy[5m])) == 0
29+
for: 15m
30+
labels:
31+
severity: warning
32+
```
33+
34+
You can choose to configure all your alerting rules into a single `PrometheusRule` object or split them into different objects (one per component). The mechanism to deploy the object(s) depends on the context: it can be deployed by the Cluster Version Operator (CVO), the Operator Lifecycle Manager (OLM) or your own operator.
35+
736
## Guidelines
837

938
Please refer to the [Alerting Consistency](https://github.com/openshift/enhancements/blob/master/enhancements/monitoring/alerting-consistency.md) OpenShift enhancement proposal for the recommendations applying to OCP built-in alerting rules.
1039

40+
If you need a review of alerting rules from the OCP monitoring team, you can reach them on the `#forum-openshift-monitoring` channel.
41+
1142
## Identifying alerting rules without a namespace label
1243

1344
The enhancement proposal mentioned above states the following for OCP built-in alerts:

content/Products/OpenshiftMonitoring/collecting_metrics.md

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -248,10 +248,6 @@ spec:
248248
app.kubernetes.io/name: my-app
249249
```
250250
251-
## Configuring Prometheus rules
252-
253-
In a similar way, you can configure the Prometheus pods with recording and alerting rules based on the metrics being collected. To do so, you should create `PrometheusRule` objects in your operator/operand namespace which will also be picked up by the Prometheus operator.
254-
255251
## Next steps
256252
257253
* [Configure alerting](alerting.md) with Prometheus.

0 commit comments

Comments
 (0)