标签从Prometheus目标传播到警报

时间:2018-07-16 16:50:18

标签: prometheus prometheus-alertmanager

我通过服务发现和重新标记,在 Prometheus 目标上添加了一些附加标签,例如instance_nameinstance_identer image description here

我想将这些标签从特定目标传播到已定义的警报。

我通读了文档,尝试了不同的配置,例如以下配置,但无法弄清楚如何实现这种传播。

alert_relabel_configs:
- source_labels: ['__meta_oci_instance_id']
  target_label: 'instance_id'

metric_relabel_configs:
- source_labels: ['__meta_oci_instance_id']
  target_label: 'instance_id'

1 个答案:

答案 0 :(得分:0)

您要执行的操作是使用relabel_configs将此标签用作目标标签(可能是instance标签)。然后在您的警报规则中,小心不要丢失标签,例如,使用without而不是by