This documentation is for a release that is no longer maintained
See documentation for the latest supported version 3 or the latest supported version 4.Questo contenuto non è disponibile nella lingua selezionata.
Chapter 6. Enabling alert routing for user-defined projects
Alert routing for user-defined projects is a Technology Preview feature only. Technology Preview features are not supported with Red Hat production service level agreements (SLAs) and might not be functionally complete. Red Hat does not recommend using them in production. These features provide early access to upcoming product features, enabling customers to test functionality and provide feedback during the development process.
For more information about the support scope of Red Hat Technology Preview features, see Technology Preview Features Support Scope.
In OpenShift Container Platform 4.10, a cluster administrator can enable alert routing for user-defined projects.
6.1. Understanding alert routing for user-defined projects Copia collegamentoCollegamento copiato negli appunti!
As a cluster administrator, you can enable alert routing for user-defined projects. After doing so, you can allow users to configure alert routing for their user-defined projects. Users can then create and configure user-defined alert routing by creating or editing the AlertmanagerConfig objects.
After a user has defined alert routing for a user-defined project, user-defined alerts are routed to the alertmanager-main pods in the openshift-monitoring namespace.
Note the following limitations and features of alert routing for user-defined projects:
-
For user-defined alerting rules, user-defined routing is scoped to the namespace in which the resource is defined. For example, a routing configuration in namespace
ns1only applies toPrometheusRulesresources in the same namespace. - The Cluster Monitoring Operator (CMO) does not deploy a second Alertmanager service dedicated to user-defined alerts. Cluster administrators continue to define the main Alertmanager configuration by using a custom secret or the OpenShift Container Platform web console.
-
When a namespace is excluded from user-defined monitoring,
AlertmanagerConfigresources in the namespace cease to be part of the Alertmanager configuration.
6.2. Enabling alert routing for user-defined projects Copia collegamentoCollegamento copiato negli appunti!
You can enable alert routing for user-defined projects. By doing so, you enable users with the alert-routing-edit role to configure alert routing and receivers for user-defined projects in Alertmanager.
Prerequisites
- You have enabled monitoring for user-defined projects.
-
You have access to the cluster as a user with the
cluster-adminrole. -
You have installed the OpenShift CLI (
oc).
Procedure
Edit the
cluster-monitoring-configConfigMapobject:oc -n openshift-monitoring edit configmap cluster-monitoring-config
$ oc -n openshift-monitoring edit configmap cluster-monitoring-configCopy to Clipboard Copied! Toggle word wrap Toggle overflow Add
enableUserAlertmanagerConfig: trueunder thealertmanagerMainkey indata/config.yaml:Copy to Clipboard Copied! Toggle word wrap Toggle overflow - 1
- When set to
true, theenableUserAlertmanagerConfigparameter enables alert routing for user-defined projects in a cluster.
- Save the file to apply the changes. Alert routing for user-defined projects is enabled automatically.
6.3. Granting users permission to configure alert routing for user-defined projects Copia collegamentoCollegamento copiato negli appunti!
You can grant users permission to configure alert routing for user-defined projects.
Prerequisites
-
You have access to the cluster as a user with the
cluster-admincluster role. - The user account that you are assigning the role to already exists.
-
You have installed the OpenShift CLI (
oc). - You have enabled monitoring for user-defined projects.
Procedure
Assign the
alert-routing-editcluster role to a user in the user-defined project:oc -n <namespace> adm policy add-role-to-user alert-routing-edit <user>
$ oc -n <namespace> adm policy add-role-to-user alert-routing-edit <user>1 Copy to Clipboard Copied! Toggle word wrap Toggle overflow - 1
- For
<namespace>, substitute the namespace for the user-defined project, such asns1. For<user>, substitute the username for the account to which you want to assign the role.
6.4. Disabling alert routing for user-defined projects Copia collegamentoCollegamento copiato negli appunti!
If you have enabled alert routing for user-defined projects, you can disable it. By doing so, you prevent users with the alert-routing-edit role from configuring alert routing for user-defined projects in Alertmanager.
Alert routing for user-defined projects is disabled by default. You do not need to disable it if the feature is not already enabled.
Prerequisites
- You have enabled monitoring for user-defined projects.
- You have enabled alert routing for user-defined projects.
-
You have access to the cluster as a user with the
cluster-adminrole. -
You have installed the OpenShift CLI (
oc).
Procedure
Edit the
cluster-monitoring-configConfigMapobject:oc -n openshift-monitoring edit configmap cluster-monitoring-config
$ oc -n openshift-monitoring edit configmap cluster-monitoring-configCopy to Clipboard Copied! Toggle word wrap Toggle overflow Change the value to
falseforenableUserAlertmanagerConfigunder thealertmanagerMainkey indata/config.yaml:Copy to Clipboard Copied! Toggle word wrap Toggle overflow - 1
- When set to
false, theenableUserAlertmanagerConfigparameter disables alert routing for user-defined projects in a cluster.
- Save the file to apply the changes. Alert routing for user-defined projects is disabled automatically.