Files
MoShiro/backend/probe/README.md
T
justme 48072737c9 feat!: probes connect to the backend directly
A probe now links to the backend like an agent (probe.json carries the
server address). The backend sends the agent list as desired state and the
probe reports its platform and build in its own hello. The agent no longer
relays the list or the probe platform. Existing probes must be re-created.
2026-10-06 22:25:16 +08:00

2.9 KiB

Monitor Probe

Probe 是网络测量的发起端,通常运行在家宽或其他需要观测的网络出口。它连接 Backend(身份、Agent 列表、状态)和 Agent(测量),执行线路任务,并把本端采集的原始数据交给 Agent 汇总上报。Probe 不提供远程命令或文件管理功能。

工作流程

Backend ──任务──> Agent <──测量会话──> Probe
   │  ▲           │                     │
   │  └──汇总并上报数据 <───┘                     │
   └─────Agent 列表、状态(Fleet 长连接)───────────┘

Probe 使用面板生成的 probe.json 读取自身身份、面板地址(server)和本地测试限制。连上面板之后,面板下发要连接的 Agent 列表;Probe 将列表缓存到同目录的 agents.json,面板暂时连不上时靠它继续测量。probe.json 含私钥,请限制文件访问权限,不要提交到版本控制。

构建

需要 .NET SDK 10。为应用 backend/global.json 的 SDK 设置,请从 backend/ 目录构建:

cd backend
dotnet build probe/src/Monitor.Probe -c Release

发布 NativeAOT 程序需要对应平台的 C/C++ 工具链;<RID> 应与构建环境和目标平台匹配:

dotnet publish probe/src/Monitor.Probe -c Release -r <RID> -p:PublishAot=true

也可在仓库根目录运行 bash scripts/publish.sh probe <RID>,再使用 scripts/package.sh probe <RID> 生成部署包。支持平台和安装流程见 ../../docs/deployment.md。

配置与运行

在管理端创建 Probe 并下载一次性身份配置,将文件保存为目标机上的 /etc/monitor/probe.json。随后运行:

monitor-probe --config /etc/monitor/probe.json

不传 --config 时默认读取 /etc/monitor/probe.json。配置中的 limits 是本地硬上限,Backend 无法远程放宽;路由器等低性能设备可调低测试码率和包速率,避免 Probe 自身成为测量瓶颈。部署时可使用仓库的 packaging/ 文件和安装脚本。

也可使用 OCI 镜像 registry.oeo.one/monitor/monitor-probe:<version>,自动选择 Linux amd64 或 arm64 镜像。容器默认读取 /etc/monitor/probe.json,并在同一目录维护 agents.json 缓存,因此挂载目录必须允许 UID/GID 1654 读写。建议使用宿主网络,并按 ICMP 测量需求添加 NET_RAW 能力。

设计说明

  • Probe 只执行编译进程序的测量模块。它不认识 Backend,不落盘测量数据,也不能执行命令或自行更新。
  • 测量模块由 backend/shared/Monitor.Measurement/ 与 Agent 共用;Probe 负责发起连接、调度任务和记录本端数据。
  • 测量模型和协议细节见 ../../docs/measurement.md 与 ../../docs/protocol.md;整体架构见 ../../docs/architecture.md。