Skip to content

Observability, completed: event tick / boot records wired, fixes, tests, CI, web UI (#16) - #77

Merged
Cd1s merged 1 commit into
mainfrom
fix/observability-complete
Sep 26, 2026
Merged

Cd1s merged 1 commit into
mainfrom
fix/observability-complete

Conversation

@Cd1s

@Cd1s Cd1s commented Sep 26, 2026

Copy link
Copy Markdown
Owner

What

#74 merged the event log, notifications and mr doctor without their triggers. This PR wires them in and finishes the feature.

Triggers

  • mr-mon's once-a-minute sampler starts mr event tick in the background, only when the DHCP lease file changed or the time stored in event.due has come. Every other minute it costs two stat()s.
  • mr-bootlog runs mr event boot when it starts. It runs mr event shutdown only when the system is going down, so a restart of the service doesn't look like a shutdown.
  • An NTP "synced" marker in /run/mr-clock, written by clock-save. busybox ntpd never lowers the kernel's maxerror, so adjtimex reports "not synchronized" even while the clock is right.

Fixes

  • The AX6000's normal watchdog boot line was read as a crash.
  • Event numbering restarted at 1 when a power cut tore the last line of the log.
  • Flash writes are bounded: at most 10 events per type per hour, an append-only device list, and a burst of new devices reported as one line.
  • WAN drops during an apply, a rollback or a scheduled redial are now info instead of warnings.
  • Secrets are removed from error text before it is shortened.
  • The background doctor no longer turns deliberate settings into events.
  • A burst of events starts one background sender instead of one per event.

Added

  • Doctor check: a WAN address inside a LAN subnet is flagged as a risk.
  • MCP monitor gets two new views: events and doctor.
  • Web UI: new page 状态 › 体检与事件 (体检 / 事件 / 通知, with a test send per channel). The overview shows 问题 and 最近事件.

Why

#16 was closed with its triggers missing and no tests.

Verification

  • Go tests for events, notifications and the doctor.
  • CI:
    • a local webhook: boot records, login locks batched into one message, a failing webhook backing off, test sends and recovery, and no secret in any file or answer;
    • WAN and failover events from the real net hooks;
    • the sampler trigger;
    • read-token access to sys.events and sys.doctor.
  • sh tools/ci.sh: ALL CHECKS PASSED.
  • Cost: nothing new stays running; the mr binary grows by 128 KiB.

Closes #16

https://claude.ai/code/session_01HWeUjo1dmS7gBkCYHrVjCr

…ests, CI, docs, web UI

#74 shipped the event log, notifications and `mr doctor` without their triggers: `mr event tick` was
never run and `mr event boot` / `shutdown` were not called. Now:

- mr-mon's sampler starts `mr event tick` (detached) when the lease file changed or event.due came;
  mr-bootlog runs `mr event boot` at start and `mr event shutdown` only when the system goes down.
- NTP "synced" marker in /run/mr-clock (clock-save): busybox ntpd never lowers the kernel's maxerror.
- Fixes: the AX6000's watchdog boot line is no crash; event numbering continues after a torn last
  line; per-type limit of 10 events an hour, append-only device list, bursts of new devices in one
  line; WAN drops during an apply / rollback / scheduled redial are info; secrets are removed before
  error text is shortened; the background doctor does not turn deliberate settings into events; one
  background sender per burst.
- Doctor: a WAN address inside a LAN subnet is a risk. MCP monitor views: events, doctor.
- Web UI: 状态 › 体检与事件 (体检 / 事件 / 通知, test send per channel); overview 问题 / 最近事件.
- Tests for events, notifications, doctor; CI with a local webhook, real net hooks, the sampler.
- Docs: sys.md, mon.md, MODULES.md, api.md, mcp.md, skill.

Closes #16

Claude-Session: https://claude.ai/code/session_01HWeUjo1dmS7gBkCYHrVjCr
@Cd1s
Cd1s merged commit 949c8c2 into main Sep 26, 2026
2 checks passed
@Cd1s
Cd1s deleted the fix/observability-complete branch September 26, 2026 01:31
Cd1s added a commit that referenced this pull request Sep 26, 2026
- 系统 → router.yaml 原文: the whole file with comments and layout, saved as typed through the normal
  path (validate, changes, risk, apply, keep / roll back). API: GET config.raw; plan / validate /
  apply take `yaml` (whole text, <= 1 MiB, strict decoding); API tokens go through the same lock.
- Global search (Ctrl-K, "/", the ⌕ button): pages by title and everyday words, devices by name /
  IP / MAC.
- The 问题 / 最近事件 overview cards came with #77; the first-run wizard is #86.

Closes #19

Claude-Session: https://claude.ai/code/session_01HWeUjo1dmS7gBkCYHrVjCr
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

提议:可观测与告警(事件通知、mr doctor、探测升级、route check)

1 participant