我有一个场景,我需要将当前时间戳从Prometheus发送到Pagerduty。我需要从Pagerduty中的自定义详细信息中访问当前时间戳,以根据当前时间编写事件规则。
目前我可以在Pagerduty ["firing", "num_firing", "num_resolved"]的Custom Details中看到三个字段。所有与警报相关的详细信息都在“触发”字段中,但作为单个字符串。
我想在Prometheus 事件规则中将时间戳添加到标签中,但问题是我将无法从“触发”字段中检索该值,因为它不是结构化格式。
从Prometheus收到的Pagerduty中的事件详细信息:
{
"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 警报管理器配置或通过警报规则来做到这一点?