// Module included in the following assemblies:
//
// * network_observability/network-observability-alerts.adoc

:_mod-docs-content-type: PROCEDURE
[id="network-observability-configuring-custom-health-rules_{context}"]
= Configuring custom health rules

[role="_abstract"]
Create custom health rules by using Prometheus Query Language (PromQL) to define an `AlertingRule` resource. These rules trigger alerts based on specific network metrics, such as traffic surges.

.Prerequisites

* Access to the cluster with `cluster-admin` privileges.
* The Network Observability Operator is installed.
* {product-title} 4.16 or later is installed.
* Familiarity with PromQL.

[IMPORTANT]
====
Custom `PrometheusRule` resources are not owned by the `FlowCollector` resource. Custom rules created in the `netobserv` namespace might be deleted if the Network Observability Operator is uninstalled. To prevent data loss, create custom rules in a different namespace, such as `openshift-monitoring`, and maintain a backup in version control.
====

.Procedure

. Define an `AlertingRule` resource in a YAML file, for example, `custom-alert.yaml`.
. Apply the custom alert rule by running the following command:
+
[source,terminal]
----
$ oc apply -f custom-alert.yaml
----

.Verification

. Confirm the `PrometheusRule` resource was created in the target namespace by running the following command:
+
[source,terminal]
----
$ oc get prometheusrules -n <namespace> -o yaml
----

. Confirm the rule is active in the {product-title} web console:
.. Navigate to *Observe* → *Alerting* to see the firing status.
.. Navigate to *Observe* → *Network Health* to view the dashboard integration.
