mirror of
https://github.com/openshift/openshift-docs.git
synced 2026-02-05 12:46:18 +01:00
66 lines
2.2 KiB
Plaintext
66 lines
2.2 KiB
Plaintext
// Module included in the following assemblies:
|
|
//
|
|
// * backup_and_restore/application_backup_and_restore/troubleshooting/oadp-monitoring.adoc
|
|
|
|
:_mod-docs-content-type: PROCEDURE
|
|
[id="creating-alerting-rules_{context}"]
|
|
= Creating an alerting rule
|
|
|
|
[role="_abstract"]
|
|
The {product-title} monitoring stack receives Alerts configured by using Alerting Rules. To create an Alerting rule for the {oadp-short} project, use one of the Metrics scraped with the user workload monitoring.
|
|
|
|
.Procedure
|
|
|
|
. Create a `PrometheusRule` YAML file with the sample `OADPBackupFailing` alert and save it as `4_create_oadp_alert_rule.yaml`:
|
|
+
|
|
.Sample `OADPBackupFailing` alert
|
|
[source,yaml]
|
|
+
|
|
----
|
|
apiVersion: monitoring.coreos.com/v1
|
|
kind: PrometheusRule
|
|
metadata:
|
|
name: sample-oadp-alert
|
|
namespace: openshift-adp
|
|
spec:
|
|
groups:
|
|
- name: sample-oadp-backup-alert
|
|
rules:
|
|
- alert: OADPBackupFailing
|
|
annotations:
|
|
description: 'OADP had {{$value | humanize}} backup failures over the last 2 hours.'
|
|
summary: OADP has issues creating backups
|
|
expr: |
|
|
increase(velero_backup_failure_total{job="openshift-adp-velero-metrics-svc"}[2h]) > 0
|
|
for: 5m
|
|
labels:
|
|
severity: warning
|
|
----
|
|
+
|
|
In this sample, the Alert displays under the following conditions:
|
|
+
|
|
* During the last 2 hours, the number of new failing backups was greater than 0 and the state persisted for at least 5 minutes.
|
|
* If the time of the first increase is less than 5 minutes, the Alert is in a `Pending` state, after which it turns into a `Firing` state.
|
|
|
|
. Apply the `4_create_oadp_alert_rule.yaml` file, which creates the `PrometheusRule` object in the `openshift-adp` namespace:
|
|
+
|
|
[source,terminal]
|
|
----
|
|
$ oc apply -f 4_create_oadp_alert_rule.yaml
|
|
----
|
|
+
|
|
.Example output
|
|
[source,terminal]
|
|
----
|
|
prometheusrule.monitoring.coreos.com/sample-oadp-alert created
|
|
----
|
|
|
|
.Verification
|
|
|
|
* After the Alert is triggered, you can view it in the following ways:
|
|
** In the *Developer* perspective, select the *Observe* menu.
|
|
** In the *Administrator* perspective under the *Observe* -> *Alerting* menu, select *User* in the *Filter* box. Otherwise, by default only the *Platform* Alerts are displayed.
|
|
+
|
|
.OADP backup failing alert
|
|
|
|
image::oadp-backup-failing-alert.png[OADP backup failing alert] |