1
0
mirror of https://github.com/openshift/openshift-docs.git synced 2026-02-07 00:48:01 +01:00
Files
openshift-docs/modules/oadp-creating-alerting-rule.adoc
2023-10-30 10:13:25 -04:00

67 lines
2.2 KiB
Plaintext

// Module included in the following assemblies:
//
// * backup_and_restore/application_backup_and_restore/troubleshooting.adoc
:_mod-docs-content-type: PROCEDURE
[id="creating-alerting-rules_{context}"]
= Creating an alerting rule
The {product-title} monitoring stack allows to receive Alerts configured using Alerting Rules. To create an Alerting rule for the OADP project, use one of the Metrics which are 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:
+
* There is an increase of new failing backups during the 2 last hours that is greater than 0 and the state persists for at least 5 minutes.
* If the time of the first increase is less than 5 minutes, the Alert will be in a `Pending` state, after which it will turn 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]