# cluster-monitor-operator alertmanager配置

## 导出现有配置

```
kubectl -n openshift-monitoring get secret alertmanager-main -ojson | jq -r '.data["alertmanager.yaml"]' | base64 -d > alertmanager.yaml
```

编辑alertmanager.yaml

```
global:
  resolve_timeout: 5m
route:
  group_wait: 30s
  group_interval: 5m
  repeat_interval: 12h
  receiver: default
  routes:
  - match:
      alertname: DeadMansSwitch
    repeat_interval: 5m
    receiver: deadmansswitch
receivers:
- name: default
  email_configs:
  - to: 'liujinye@hisuntech.com'
    from: 'cicd@email.prardeum.com'
    smarthost: 'smtpdm.aliyun.com:465'
    auth_username: 'cicd@email.prardeum.com'
    auth_password: 'xxxxx'
    auth_secret: 'cicd@email.prardeum.com'
    auth_identity: 'cicd@email.prardeum.com'
- name: deadmansswitch
```

## 编写完成后，应用配置

```
kubectl -n openshift-monitoring create secret generic alertmanager-main --from-literal=alertmanager.yaml="$(< alertmanager.yaml)" --dry-run -oyaml | kubectl -n openshift-monitoring replace secret --filename=-
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://liujinye.gitbook.io/openshift-docs/cluster-monitor-opertor/clustermonitoroperatoralertmanager-pei-zhi.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
