Skip to content

健康与状态观测

怎么看 fleet 健康、怎么读路由观测。判定原理见 健康推导

所有 /control/v1/admin/*/control/v1/ui/* 调用需携带 -H "Authorization: Bearer <admin token>",示例中省略。


健康五态

控制面持久化每台机器的快照、对账与应用结果,自动推导五态健康:

状态含义
ok一切正常,实际状态等于期望状态
stale落后:还没追上最新 generation,或超过 stale_after(默认 900 s)没上报
degraded应用失败、上报 degraded、或检测到配置漂移
down超过 down_after(默认 3600 s)完全静默(unknown 除外)
unknown还没收到过任何上报

阈值在读取时叠加,改阈值无需改库。配置见 健康判定

bash
# 机群概览
curl -s "https://api.natlan.io/control/v1/admin/health"

# 单节点详细健康(最近一次 snapshot / report / apply)
curl -s "https://api.natlan.io/control/v1/admin/nodes/edge1/health"

# 历史事件(排错常用;kind 取 snapshot / report / apply / reresolve)
curl -s "https://api.natlan.io/control/v1/admin/nodes/edge1/status-events?kind=apply&limit=20"

控制台侧有一次取全的聚合视图 GET /ui/fleet/overviewGET /ui/nodes/{id}/overview,见 控制台 BFF


路由观测

bash
# fleet 路由概览
curl -s "https://api.natlan.io/control/v1/admin/routing/fleet"

# 单节点路由摘要(含 peers 分桶)
curl -s "https://api.natlan.io/control/v1/admin/nodes/edge1/routing/summary"

# 起源 AS / 前缀翻页 / 时间线
curl -s "https://api.natlan.io/control/v1/admin/nodes/edge1/routing/origins"
curl -s "https://api.natlan.io/control/v1/admin/nodes/edge1/routing/prefixes?limit=1000&offset=0"
curl -s "https://api.natlan.io/control/v1/admin/nodes/edge1/routing/timeline"

peers 分桶(最优路由来源计数)是判断「某节点在不在用 iBGP、在不在用某条会话」的最快信号。 明细存在索引表 node_route_entries,检索参数见 管理面 API


指标与自观测

GET /ui/nodes/metrics 返回全 fleet 的指标矩阵:共享桶网格上的 CPU、RSS、流量、对账失败序列。数据来自 agent 的自观测 5min 存档,保留 60 天。

空桶是 null 而不是 0——缺数据是缺口,不是零reconcile_failures0 才表示「有上报且无失败」。

GET /ui/nodes 的行富化标量给出每节点的 drift 数、BGP 会话 up/total、当前吞吐,适合做一屏总览。


抖动观测

对端会话或前缀反复抖动时的观测路径:

榜单根因定位处置

bash
# 会话级榜单
curl -s "https://api.natlan.io/control/v1/ui/fleet/bgp-flaps"

# 前缀级榜单(?group=prefix 每行内嵌根因定位)
curl -s "https://api.natlan.io/control/v1/ui/fleet/prefix-flaps?group=prefix"

# 「哪家对端最抖」
curl -s "https://api.natlan.io/control/v1/ui/fleet/flap-peers"

# 告警事件流(active=1 只看在开)
curl -s "https://api.natlan.io/control/v1/ui/fleet/flap-alerts?active=1"

一线操作与判例见 抖动处置,算法见 flap 检测


节点本机排查

bash
journalctl -u dn42-node-agent@edge1.service -n 120 --no-pager
docker ps --filter label=dn42.managed=true
docker exec dn42-edge1-dn42-wg-gateway-1 wg show
docker exec dn42-edge1-dn42-bird-router-1 birdc show protocols

容器名固定为 dn42-<node_id>-dn42-<role>-1

不想登节点时,控制面提供两条过境通道:主动拨测 与 agent 日志查看。