> ## 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.

# 事件与变更

> 用 MoleSignal 命令行列出并查看事件，查看谁在值班，确认和解决事件，为大盘添加标注，在 CI 中运行拨测，并执行已批准的变更。

## 变更如何执行

会改动内容的命令（例如确认事件）通过托管工具向 MoleSignal 发起变更，与 Mole Agent 和 Agent 工具相同。每个工具如何执行由组织的 Tool Policy 决定，在 **Mole Agent → 设置 → 工具与能力** 中设置：

| 执行方式 | 命令的行为 |
| - | - |
| 自动执行 | 变更立即执行。 |
| 需要确认 | MoleSignal 要求确认，命令在终端中询问。`-y`（`--yes`）预先回答“是”，适合 CI。没有终端也没有 `--yes` 时不做任何改动。 |
| 单人审批、双人审批 | MoleSignal 在 **Mole Agent → 审批** 中为审批人创建审批请求。命令输出这个审批并以 `3` 退出。带 `--wait` 时，命令等待审批结果，最长等待 `--timeout`（默认 30 分钟），批准后执行变更。 |
| 禁止执行 | 命令失败并说明原因。 |

工具没有单独的策略时按其风险执行：默认情况下，`create_annotation` 与 `submit_search_job` 需要确认，`acknowledge_incident`、`resolve_incident` 与 `run_synthetic_monitor` 需要单人审批。`--reason` 说明原因，供审批人与审计日志查看。

确认需要 MCP 协议版本 2026-07-28，MoleSignal 支持时命令行会使用这个版本。`molesignal status` 显示当前使用的版本。

## 列出事件

```bash theme={null}
molesignal incidents
```

列表按时间从新到旧显示进行中的事件，以及它们的状态、严重程度、持续时间、服务和摘要。`--status resolved` 或 `--status all` 列出其他事件，`--since 7d` 只看此后开始的事件，`-n` 设置条数。

`molesignal incidents show` 输出一个事件：它的规则、时间、服务、标签、Runbook 等备注，以及采样的链路。`--rca` 附上根因分析，`--web` 在 MoleSignal 中打开这个事件：

```bash theme={null}
molesignal incidents show <事件> --rca
```

## 确认与解决事件

```bash theme={null}
molesignal incidents ack <事件>
```

```bash theme={null}
molesignal incidents resolve <事件> --reason "已回滚到 2.3.9"
```

两者都经过 Tool Policy，需要 `alerts.acknowledge`。

## 查看谁在值班

```bash theme={null}
molesignal oncall
```

列表显示每个已启用的值班排班当前由谁值班。`--schedule` 只看一个排班，`--at` 查看其他时间，例如 `--at "2026-10-27 09:00"`。

## 执行已批准的变更

`molesignal approvals` 列出等待审批人处理的审批请求，以及已批准但尚未执行的请求，来源包括 Mole Agent、Agent 工具和命令行。`--all` 也列出已处理的请求。

```bash theme={null}
molesignal approvals
```

`molesignal approvals show <审批>` 输出一个请求：它的操作、对象、原因、影响和审批记录。`molesignal approvals execute <审批>` 执行已批准的变更；MoleSignal 可能先要求确认：

```bash theme={null}
molesignal approvals execute <审批>
```

## 为大盘添加标注

`molesignal annotate` 在某一时刻或一段时间上添加标注，显示在所有大盘或某一个大盘上：

```bash theme={null}
molesignal annotate "Release 2.4.0" --tags release,checkout --yes
```

| 选项 | 含义 |
| - | - |
| `--description <文本>` | 更多说明。 |
| `--tags <a,b>` | 用于查找的标签。 |
| `--dashboard <ID>` | 只显示在这个大盘上。 |
| `--stream <数据流>` | 标注涉及的数据流。 |
| `--time <时间>`、`--end <时间>` | 开始与结束时间。默认是当前时刻。 |

标注需要 `dashboards.edit`。

## 运行拨测

`molesignal synthetics` 列出拨测检查，以及它们的类型、状态和生命周期。`molesignal synthetics results <检查>` 列出一个检查在各地点最近的运行结果、耗时，以及失败的原因。检查可以用 ID 或名称指定。

`molesignal synthetics run` 让一个检查立即在它的每个地点运行一次。带 `--wait` 时，命令等待运行结果，有一次运行失败或在 `--timeout`（默认 10 分钟）内没有完成时以 `1` 退出，流水线可以据此拦下发布：

```bash theme={null}
molesignal synthetics run "Checkout API" --wait --yes
```

结果为 healthy 或 flaky 时算通过。运行检查需要 `synthetics.manage`；要在 CI 中无需审批地运行检查，在 Tool Policy 中把 `run_synthetic_monitor` 设为 **自动执行**。


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