In OpenShift Container Platform, you can use the Alerts UI to manage alerts, silences, and alerting rules.
Alerting rules contain a set of conditions that outline a particular state within a cluster. Alerts are triggered when those conditions are true. An alerting rule can be assigned a severity that defines how the alerts are routed.
An alert is fired when the conditions that are defined in an alerting rule are true. Alerts notify that a set of conditions apply in an OpenShift Container Platform cluster.
You can configure the alerting system to route alerts to a receiver and send notifications via email, send pager notifications, or forward them to another system by using a webhook.
A silence can be applied to an alert to prevent sending notifications when the conditions for an alert are true. You can mute an alert after the initial notification, while you work on resolving the underlying issue.
Click → and then click to list the alerting rules in the OpenShift cluster. You can apply custom filters to search for a specific alert rule. The alert state column indicates whether the alert is currently firing or is silenced.
![]() |
Click the alerting rule name to view its details such as its severity, description, and log message. You can also view the PromQL expression, which checks for the alert.
![]() |
Scroll down to view the graph that displays the time when the alert was detected.
![]() |
Click → to view the alerts that are currently firing in the cluster. You can apply custom filters to find a specific alert.
![]() |
Click the alert name to view its properties. The graph displays the time when the alert was detected.
![]() |
Scroll down to view the alert details and labels. You can create a receiver to match a label and forward the alert.
![]() |
You can silence an alert for a period of time to stop sending new notifications to a receiver. For example, you can silence an alert while you are troubleshooting a problem, to stop sending new alert emails, or silence certain alerts that are expected to be fired during a scheduled maintenance window. Click → to display a list of the alerts that are currently firing. Then click the three dots icon at the right of the alert, and click .
![]() |
The alert silence is configured to start immediately after it is created. You can clear the field to set a specific start time.
You can select a predefined duration for the alert silence.
Select - in the field to set when the silence begins and finishes.
![]() |
A comment is required when you create an alert silence. This comment is saved in the alert silence details.
![]() |
Click → and then click to view the alert silences in the cluster.
![]() |
You can see the silence name, start time, end time, matching labels, state, and associated comment.
![]() |
You can also view the alerts that match the silence.
![]() |
Click → to return to the alerting main section.
The PersistentVolumeUsageNearFull alert is not displayed in the list because it is currently silenced.
Clear the filter by clicking to display all the alerts.
![]() |
Observe that the PersistentVolumeUsageNearFull alert is listed and marked as silenced.
![]() |
You can view the firing alerts in the Alerting UI. Alerts are not configured by default to be sent to any notification systems. You can configure OpenShift Container Platform to send alerts to the following receiver types:
PagerDuty
Slack
Webhook
By routing alerts to receivers, you can send timely notifications to the appropriate teams when failures occur. For example, critical alerts require immediate attention and are typically paged to an individual or to a critical response team. Alerts that provide non-critical warning notifications might instead be routed to a ticketing system for non-immediate review.
The alerting system uses Alertmanager, which is a component from the Prometheus monitoring stack.
The Alertmanager configuration is saved in the alertmanager-main secret in the openshift-monitoring namespace.
Click → , and then click and to open the Alertmanager configuration page. You can click the vertical ellipsis icon at the right to create an alert receiver or to edit the Alertmanager configuration file.
![]() |
The Alertmanager configuration page lists the current alert routing parameters.
![]() |
Scroll down to view the configured alert receivers. Click to add a receiver. You can click the three dots icon at the right of each receiver to edit its settings or to delete it.
![]() |
You can view and edit the current Alertmanager configuration by clicking .
![]() |
Click to create a receiver to send the alerts by email. Complete the values according to the following table, and then scroll down and click .
| Field | Value |
|---|---|
ocp-admins@example.com
| |
| SMTP configuration | |
| Checked | |
alerts@ocp4.example.com
| |
192.168.50.254:25
| |
localhost
| |
smtp_training
| |
Red_H4T@!
| |
| (empty) | |
| (empty) | |
| Unset | |
| Routing labels | |
alertname
| |
PersistentVolumeUsageNearFull
| |
| Unset | |
The Alertmanager configuration changes are applied and the alerting system reloads in a few minutes.
The Alertmanager configuration is saved in the alertmanager-main secret in the openshift-monitoring namespace.
[user@host ~]$ oc get secret/alertmanager-main -n openshift-monitoring
NAME TYPE DATA AGE
alertmanager-main Opaque 1 7dYou can extract the alertmanager-main secret to view the alertmanager.yaml configuration file.
[user@host ~]$ oc extract secret/alertmanager-main -n openshift-monitoring \
--to ./ --confirm
alertmanager.yamlThe default alertmanager.yaml configuration file contains many unnecessary quotation marks.
Remove the quotation marks by using the sed command to improve readability.
[user@host ~]$ sed -f script.sed alertmanager.yamlAlthough removing the extraneous quotation mark characters is not required, it improves readability.
The quotation mark characters are not required in a YAML file, except to represent null as a string.
The previous sed command uses this script file to remove all the quotation marks and converts null to a string.
#!/usr/bin/sed -fs/"//gs/\<\(null\)\>/'\1'/g
The monitoring stack can send alerts by email through an SMTP server.
The following example sends the PersistentVolumeUsageNearFull alerts to the ocp-admins@example.com email address.
global: resolve_timeout: 5msmtp_from:alerts@ocp4.example.com![]()
smtp_smarthost:'192.168.50.254:25'![]()
smtp_hello:localhost![]()
smtp_auth_username:smtp_training![]()
smtp_auth_password:Red_H4T@!![]()
smtp_require_tls:false...output omitted... inhibit_rules: ...output omitted... receivers: ...output omitted... -
name:![]()
email_configs:-
to:ocp-admins@example.comroute: group_by: - namespace
group_interval:2mgroup_wait: 30s receiver: Default
repeat_interval:1mroutes: ...output omitted... -
receiver:![]()
match:alertname:PersistentVolumeUsageNearFull
The global SMTP host.
If you do not define | |
The global email sender address.
If you do not define | |
The hello parameter for the SMTP connection. | |
The global SMTP username for optional authentication.
If you do not define | |
The global SMTP password for optional authentication.
This password is used if | |
A global setting to specify whether TLS is required for SMTP.
You can override this setting by using | |
An arbitrary name for the receiver. A route specifies this receiver name for a match. | |
This setting indicates that the receiver sends alerts by email. | |
The | |
Configure the | |
The receiver to use if the | |
The expression to match a specific alert name. |
You can update the Alertmanager configuration by setting the data of the alertmanager-main secret in the openshift-monitoring namespace with the content of the alertmanager.yaml file.
[user@host ~]$ oc set data secret/alertmanager-main -n openshift-monitoring \
--from-file alertmanager.yaml
secret/alertmanager-main data updatedYou can view the progression in the Alertmanager stateful set logs.
A successful update generates the log message: Completed loading of configuration file.
[user@host ~]$oc logs -f statefulset.apps/alertmanager-main -c alertmanager \ -n openshift-monitoringFound 2 pods, using pod/alertmanager-main-0...output omitted... ts=2024-01-31T01:02:03.064Z caller=coordinator.go:113 level=info component=configuration msg="Loading configuration file" file=/etc/alertmanager/config_out/alertmanager.env.yamlts=2024-01-31T01:02:03.128Z caller=coordinator.go:126 level=info component=configuration msg="Completed loading of configuration file" file=/etc/alertmanager/config_out/alertmanager.env.yaml
An incorrect configuration generates a failed log message.
If you see configuration errors in the logs, then modify the alertmanager.yaml file and reapply your changes to the alertmanager-main secret in the openshift-monitoring namespace.
...output omitted...
ts=2024-01-31T02:03:04.256Z caller=coordinator.go:113 level=info component=configuration msg="Loading configuration file" file=/etc/alertmanager/config_out/alertmanager.env.yaml
ts=2024-01-31T02:03:04.512Z caller=coordinator.go:118 level=error component=configuration msg="Loading configuration file failed" file=/etc/alertmanager/config_out/alertmanager.env.yaml err="no global SMTP smarthost set"For more information about managing alerts in OpenShift, refer to the Managing Alerts chapter in the Red Hat OpenShift Container Platform 4.14 Monitoring documentation at https://access.redhat.com/documentation/en-us/openshift_container_platform/4.14/html-single/monitoring/index#managing-alerts