> ## 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/sources
GET /api/v1/alerts/sources/{id}
GET /api/v1/alerts/sources/clusters
```

第一个调用列出组织的[告警来源](https://docs.molesignal.com/zh-Hans/alerting/sources.md)，第二个调用返回单个来源，第三个调用返回本集群在联邦里的 ID（`local`，没开联邦时为空）和接收集群可以选的集群。三个调用都需要 `alerts.sources.read`。接口从不返回 Token 本身和它的哈希。

| 字段 | 类型 | 说明 |
| - | - | - |
| `id` | string | 来源 ID。 |
| `name` | string | 名称。 |
| `kind` | string | `api`、`alertmanager`、`grafana`、`datadog`、`pagerduty`、`aliyun_cms`、`tencent_monitor`、`aws_cloudwatch`、`zabbix` 或 `email`。 |
| `enabled` | boolean | 停用的来源拒收告警。 |
| `escalation_policy_id` | string \| null | 它开的事件按哪条升级策略升级；`default` 为默认策略，`null` 不升级，只按通知策略通知。 |
| `severity` | string | 告警没带严重度时用的。 |
| `labels` | object | 加在它开的每个事件上的附加标签。 |
| `token_prefix` | string | Token 的前缀 `ms_<16 位>`。完整的 Token 只在新建和轮换时返回一次。 |
| `home_cluster` | string | 开事件的联邦集群；空表示本集群。 |
| `intake_path` | string | 接入地址的路径，所有来源相同。 |
| `last_intake_at` | integer \| null | 本集群最近一次收到它的请求的时间（微秒）。 |
| `created_by`、`created_at`、`updated_at` | | 谁在什么时候建的，最后修改时间（微秒）。 |

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

```json 200 theme={null}
[
  {
    "id": "3KEJ1mZqf0bY0b8XUgD4tkd2Vwq",
    "name": "Production Prometheus",
    "kind": "alertmanager",
    "enabled": true,
    "escalation_policy_id": "default",
    "severity": "warning",
    "labels": { "team": "payments" },
    "token_prefix": "ms_aB3kZ1xT9pQrU7nM",
    "home_cluster": "",
    "intake_path": "/api/v1/intake/alerts",
    "created_by": "<user-id>",
    "created_at": 1790000000000000,
    "updated_at": 1790000000000000,
    "last_intake_at": 1790000300000000
  }
]
```

接收集群可以选的集群：

```json theme={null}
{
  "local": "cluster-cn-east",
  "clusters": [
    { "id": "cluster-cn-east", "name": "cluster-cn-east", "local": true },
    { "id": "cluster-eu-west", "name": "EU West", "local": false }
  ]
}
```


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