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.5.7. 应用自定义 Alertmanager 配置
				您可以通过编辑 openshift-monitoring 项目中的 alertmanager-main secret,覆盖默认的 Alertmanager 配置。
			
先决条件
- 
						您可以使用具有 
cluster-admin角色的用户访问集群。 
流程
要从 CLI 更改 Alertmanager 配置:
将当前活跃的 Alertmanager 配置输出到
alertmanager.yaml文件:oc -n openshift-monitoring get secret alertmanager-main --template='{{ index .data "alertmanager.yaml" }}' | base64 --decode > alertmanager.yaml$ oc -n openshift-monitoring get secret alertmanager-main --template='{{ index .data "alertmanager.yaml" }}' | base64 --decode > alertmanager.yamlCopy to Clipboard Copied! Toggle word wrap Toggle overflow 编辑
alertmanager.yaml中的配置:Copy to Clipboard Copied! Toggle word wrap Toggle overflow 以下 Alertmanager 配置示例将 PagerDuty 配置为警报接收器:
Copy to Clipboard Copied! Toggle word wrap Toggle overflow 采用此配置时,由
example-app服务触发的、严重性为critical的警报将使用team-frontend-page接收器发送。通常情况下,这些类型的警报会传给个人或关键响应团队。应用文件中的新配置:
oc -n openshift-monitoring create secret generic alertmanager-main --from-file=alertmanager.yaml --dry-run=client -o=yaml | oc -n openshift-monitoring replace secret --filename=-
$ oc -n openshift-monitoring create secret generic alertmanager-main --from-file=alertmanager.yaml --dry-run=client -o=yaml | oc -n openshift-monitoring replace secret --filename=-Copy to Clipboard Copied! Toggle word wrap Toggle overflow 
要从 OpenShift Container Platform Web 控制台更改 Alertmanager 配置:
- 
						进入 web 控制台的 Administration 
Cluster Settings Global Configuration Alertmanager YAML 页面。  - 修改 YAML 配置文件。
 - 选择 Save。