You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
As a cluster administrator, you can create new alerting rules based on platform metrics.
10
+
These alerting rules trigger alerts based on the values of chosen metrics.
11
+
12
+
[NOTE]
13
+
====
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
+
17
+
.Prerequisites
18
+
19
+
* You are logged in as a user that has the `cluster-admin` role.
20
+
* You have installed the OpenShift CLI (`oc`).
21
+
* You have enabled Technology Preview features, and all nodes in the cluster are ready.
22
+
23
+
24
+
.Procedure
25
+
26
+
. Create a new YAML configuration file named `example-alerting-rule.yaml` in the `openshift-monitoring` namespace.
27
+
28
+
. Add an `AlertingRule` resource to the YAML file.
29
+
The following example creates a new alerting rule named `example`, similar to the default `watchdog` alert:
30
+
+
31
+
[source,yaml]
32
+
----
33
+
apiVersion: monitoring.openshift.io/v1alpha1
34
+
kind: AlertingRule
35
+
metadata:
36
+
name: example
37
+
namespace: openshift-monitoring
38
+
spec:
39
+
groups:
40
+
- name: example-rules
41
+
rules:
42
+
- alert: ExampleAlert <1>
43
+
expr: vector(1) <2>
44
+
----
45
+
<1> The name of the alerting rule you want to create.
46
+
<2> The PromQL query expression that defines the new rule.
{product-title}{product-version} monitoring ships with a large set of default alerting rules for platform metrics.
13
+
As a cluster administrator, you can customize this set of rules in two ways:
14
+
15
+
* Modify the settings for existing platform alerting rules by adjusting thresholds or by adding and modifying labels.
16
+
For example, you can change the `severity` label for an alert from `warning` to `critical` to help you route and triage issues flagged by an alert.
17
+
18
+
* Define and add new custom alerting rules by constructing a query expression based on core platform metrics in the `openshift-monitoring` namespace.
19
+
20
+
.Core platform alerting rule considerations
21
+
22
+
* New alerting rules must be based on the default {product-title} monitoring metrics.
23
+
24
+
* You can only add and modify alerting rules. You cannot create new recording rules or modify existing recording rules.
25
+
26
+
* If you modify existing platform alerting rules by using an `AlertRelabelConfig` object, your modifications are not reflected in the Prometheus alerts API.
27
+
Therefore, any dropped alerts still appear in the {product-title} web console even though they are no longer forwarded to Alertmanager.
28
+
Additionally, any modifications to alerts, such as a changed `severity` label, do not appear in the web console.
* See the link:https://prometheus.io/docs/practices/alerting/[Prometheus alerting documentation] for further guidelines on optimizing alerts
37
42
* See xref:../monitoring/monitoring-overview.adoc#monitoring-overview[Monitoring overview] for details about {product-title}{product-version} monitoring architecture
* See xref:../monitoring/monitoring-overview.adoc#monitoring-overview[Monitoring overview] for details about {product-title}{product-version} monitoring architecture.
66
+
* See the link:https://prometheus.io/docs/alerting/alertmanager/[Alertmanager documentation] for information about alerting rules.
67
+
* See the link:https://prometheus.io/docs/prometheus/latest/configuration/configuration/#relabel_config[Prometheus relabeling documentation] for information about how relabeling works.
68
+
* See the link:https://prometheus.io/docs/practices/alerting/[Prometheus alerting documentation] for further guidelines on optimizing alerts.
0 commit comments