> ## Documentation Index
> Fetch the complete documentation index at: https://docs.molesignal.com/llms.txt
> Use this file to discover all available pages before exploring further.

# 外部事件的来源

> 读取外部来源开的事件在来源那一侧的状态：来源、去重键和通知分组里的告警。

```http theme={null}
GET /api/v1/alerts/incidents/{id}/source
```

返回一个由[告警来源](https://docs.molesignal.com/zh-Hans/alerting/sources.md)开的事件在来源那一侧的状态，需要 `alerts.incidents.read`。这类事件带标签 `alert.source=external`，`rule_id` 是来源的 ID。

| 字段 | 说明 |
| - | - |
| `source` | 来源，字段见[列出告警来源](https://docs.molesignal.com/zh-Hans/api/alerting/list-sources.md)；来源已删除时为 `null`。 |
| `dedup_key` | 去重键。 |
| `last_event_at` | 这个去重键上用过的最晚的发送方时间（微秒），比它早的消息被忽略；API 类型为 `null`。 |
| `last_intake_at` | 最近一次收到这条告警的时间（微秒）。 |
| `members` | Alertmanager 与 Grafana 的通知分组里的告警，最多 100 条：`status`（`firing` 或 `resolved`）、`labels`、`summary`、`starts_at`、`ends_at` 和回到发送方的 `url`；其他类型为空。 |

```bash cURL theme={null}
curl http://localhost:5080/api/v1/alerts/incidents/$INCIDENT_ID/source \
  -H "authorization: Bearer $MS_TOKEN"
```

```json 200 theme={null}
{
  "source": { "id": "3KEJ1mZqf0bY0b8XUgD4tkd2Vwq", "name": "Production Prometheus", "kind": "alertmanager", "...": "..." },
  "dedup_key": "http://alertmanager.example.com:9093|{}:{alertname=\"HighCPU\"}",
  "last_event_at": 1790000240000000,
  "last_intake_at": 1790000300000000,
  "members": [
    {
      "status": "firing",
      "labels": { "alertname": "HighCPU", "instance": "web-1:9100", "job": "node" },
      "summary": "CPU above 90% on web-1",
      "starts_at": 1790000000000000,
      "url": "http://prometheus.example.com:9090/graph"
    }
  ]
}
```

**错误**

| 状态码 | 原因 |
| - | - |
| `404` | 事件不存在，或不是告警来源开的。 |


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.