如何让 Prometheus 根据 Alert 标签向两个不同的 Alertmanager 发送 Alerts?
How to make Prometheus send Alerts to two different Alertmanagers based on Alert labels?
我有以下两个警报:
alert: InstanceDown
expr: (up == 0) and (team == "foo")
for: 5m
labels:
severity: page
team: foo
annotations:
summary: "Instance {{$labels.instance}} down"
alert: InstanceDown
expr: (up == 0) and (team == "bar")
for: 5m
labels:
severity: page
team: bar
annotations:
summary: "Instance {{$labels.instance}} down"
我如何让 Prometheus 将第一个警报发送到 alertmanager.example.com/team-foo
公开的一个警报管理器,然后将第二个警报发送到 alertmanager.example.com/team-bar
公开的另一个警报管理器?
我想我需要使用服务发现和重新标记,但还不能更进一步。
如果重要的话,我正在使用 prometheus-operator。
我认为您无法过滤哪些警报发送到哪个 Alertmanager。但是,您可以将所有警报发送到 2(或 N)个 Alertmanager 实例,并将每个 Alertmanager 配置为路由某些警报并忽略所有其他警报(即将它们路由到指定的接收者,没有电子邮件,没有 Slack,什么都没有)。
我有以下两个警报:
alert: InstanceDown
expr: (up == 0) and (team == "foo")
for: 5m
labels:
severity: page
team: foo
annotations:
summary: "Instance {{$labels.instance}} down"
alert: InstanceDown
expr: (up == 0) and (team == "bar")
for: 5m
labels:
severity: page
team: bar
annotations:
summary: "Instance {{$labels.instance}} down"
我如何让 Prometheus 将第一个警报发送到 alertmanager.example.com/team-foo
公开的一个警报管理器,然后将第二个警报发送到 alertmanager.example.com/team-bar
公开的另一个警报管理器?
我想我需要使用服务发现和重新标记,但还不能更进一步。
如果重要的话,我正在使用 prometheus-operator。
我认为您无法过滤哪些警报发送到哪个 Alertmanager。但是,您可以将所有警报发送到 2(或 N)个 Alertmanager 实例,并将每个 Alertmanager 配置为路由某些警报并忽略所有其他警报(即将它们路由到指定的接收者,没有电子邮件,没有 Slack,什么都没有)。