我们有两个不同的团队在不同的应用程序上工作,我想通过使用相同的警报表达式向不同的空闲通道发送警报通知。我找到了一些例子,但不明白在尝试添加新路由时使用receiver: 'default'的主要原因是什么?它的作用是什么,如果它影响如果ı改变这一点呢?
同时,如果您能帮助我如何将通知发送到多个空闲通道,将不胜感激。新的是我试过的。
电流alertmanager.yml
receivers:
- name: 'team-1'
slack_configs:
- api_url: 'https://hooks.slack.com/services/1'
channel: '#hub-alerts'
route:
group_wait: 10s
group_interval: 5m
receiver: 'team-1'
repeat_interval: 1h
group_by: [datacenter]新alertmanager.yml
alertmanager.yml:
receivers:
- name: 'team-1'
slack_configs:
- api_url: 'https://hooks.slack.com/services/1'
channel: '#channel-1'
send_resolved: true
- name: 'team-2'
slack_configs:
- api_url: 'https://hooks.slack.com/services/2'
channel: '#channel-2'
send_resolved: true
route:
group_wait: 10s
group_interval: 5m
repeat_interval: 1h
group_by: [datacenter]
receiver: 'default'
routes:
- receiver: 'team-1'
- receiver: 'team-2'发布于 2020-07-04 05:14:56
您需要将路由上的route属性设置为true。默认情况下,它是假的。
AlertManager的默认行为是遍历路由以获得匹配,并在它找到匹配的第一个节点退出。
您要做的是在比赛中发出警报,并继续搜索其他火柴,并将其也发射出去。
相关文档部分:https://prometheus.io/docs/alerting/latest/configuration/#route
使用以下示例:https://awesome-prometheus-alerts.grep.to/alertmanager.html
上面的例子行列式,以防它中断。
# alertmanager.yml
route:
# When a new group of alerts is created by an incoming alert, wait at
# least 'group_wait' to send the initial notification.
# This way ensures that you get multiple alerts for the same group that start
# firing shortly after another are batched together on the first
# notification.
group_wait: 10s
# When the first notification was sent, wait 'group_interval' to send a batch
# of new alerts that started firing for that group.
group_interval: 5m
# If an alert has successfully been sent, wait 'repeat_interval' to
# resend them.
repeat_interval: 30m
# A default receiver
receiver: "slack"
# All the above attributes are inherited by all child routes and can
# overwritten on each.
routes:
- receiver: "slack"
group_wait: 10s
match_re:
severity: critical|warning
continue: true
- receiver: "pager"
group_wait: 10s
match_re:
severity: critical
continue: true
receivers:
- name: "slack"
slack_configs:
- api_url: 'https://hooks.slack.com/services/XXXXXXXXX/XXXXXXXXX/xxxxxxxxxxxxxxxxxxxxxxxxxxx'
send_resolved: true
channel: 'monitoring'
text: "{{ range .Alerts }}<!channel> {{ .Annotations.summary }}\n{{ .Annotations.description }}\n{{ end }}"
- name: "pager"
webhook_config:
- url: http://a.b.c.d:8080/send/sms
send_resolved: true发布于 2022-11-01 10:52:01
我有以下配置的警报管理配置,现在我需要指向一个空接收器的信息警报,我可以有多个接收器和接收器吗?
kind: AlertmanagerConfig
metadata:
name: Prometheus-alertmanager-config
namespace: Prometheus
spec:
route:
receiver: alert-email-pagerduty-config
groupBy: ['alertname', 'priority','severity']
groupWait: 30s
groupInterval: 5m
repeatInterval: 15m
continue: true
receivers:
- name: alert-email-pagerduty-config
emailConfigs:
- to: {{.to_email}}
sendResolved: true
from: {{.from_email}}
smarthost: {{.smarthost}}
authUsername: {{.mail_username}}
authPassword:
name: 'alert-smtp-password'
key: 'password'
requireTLS: true
---
apiVersion: v1
kind: Secret
type: Opaque
metadata:
name: alert-smtp-password
namespace: prometheus
stringData:
password: {{.mail_password}}https://stackoverflow.com/questions/62672730
复制相似问题