【发布时间】:2018-11-26 11:21:08
【问题描述】:
我有一个场景,我需要将当前时间戳从 Prometheus 发送到 Pagerduty。我需要从 Pagerduty 中的 Custom details 访问当前时间戳,以根据当前时间编写 Event Rules。
目前我可以在 Pagerduty ["firing", "num_firing", "num_resolved"] 中看到 Custom Details 内的三个字段。所有与警报相关的详细信息都在 "firing" 字段中,但作为单个字符串。
我曾想过将时间戳添加到 Prometheus 事件规则中的 Labels,但问题是我无法从 Prometheus 事件规则中检索该值strong>“触发” 字段,因为它不是结构化格式。
Pagerduty 中的事件详情来自 Prometheus:
{
"client": "AlertManager",
"client_url": "http://********/",
"description": "[FIRING:1] **************",
"event_type": "trigger",
"incident_key": "********",
"service_key": "********",
"details": {
"firing": "Labels:\n - alertname = ******\n - datacenter = *****\n - instance = ******\n - instance_id = ******\n - instance_type = ******\n - job = ******\n - metrics = ******\n - node = ******\n - pod = ******\n - private_ip = ******\n - public_ip = ******\n - service = ******\n - severity = critical\nAnnotations:\n - description = ******\n - summary = ******\nSource: ******\n",
"num_firing": "1",
"num_resolved": "0",
"resolved": ""
}
}
我需要在 “触发” 字段的同一级别添加当前时间戳。有没有办法通过 Prometheus 警报管理器 配置或通过 警报规则 做到这一点?
【问题讨论】:
标签: prometheus prometheus-alertmanager pagerduty