1.3.2. 配置 AlertManager
集成外部消息工具,如 email、Slack 和 PagerDuty 以接收来自 AlertManager 的通知。您必须覆盖 open-cluster-management-observability
命名空间中的 alertmanager-config
secret 来添加集成,并为 AlertManager 配置路由。完成以下步骤以更新自定义接收器规则:
从
alertmanager-config
secret 中提取数据。运行以下命令:oc -n open-cluster-management-observability get secret alertmanager-config --template='{{ index .data "alertmanager.yaml" }}' |base64 -d > alertmanager.yaml
oc -n open-cluster-management-observability get secret alertmanager-config --template='{{ index .data "alertmanager.yaml" }}' |base64 -d > alertmanager.yaml
Copy to Clipboard Copied! Toggle word wrap Toggle overflow 运行以下命令,编辑并保存
alertmanager.yaml
文件配置:oc -n open-cluster-management-observability create secret generic alertmanager-config --from-file=alertmanager.yaml --dry-run -o=yaml | oc -n open-cluster-management-observability replace secret --filename=-
oc -n open-cluster-management-observability create secret generic alertmanager-config --from-file=alertmanager.yaml --dry-run -o=yaml | oc -n open-cluster-management-observability replace secret --filename=-
Copy to Clipboard Copied! Toggle word wrap Toggle overflow 更新的 secret 可能与以下类似:
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
您的更改会在修改后立即生效。如需 AlertManager 的示例,请参阅 prometheus/alertmanager。