Repository navigation
fix: 通知巡检状态与安装脚本 PATH 的几处遗漏 - #12
Merged
Merged
Conversation
离线通知在没有渠道时不标记 down_since,流量档位和到期汇总日期此前没有照做: 先跨过阈值、后配渠道,这条提醒永远不发;当天 9 点后才配渠道,汇总要等到次日。 两处都改为没有渠道时不记。 巡检的内存状态按节点 id 存,而 id 是 rowid,删掉最新的节点再新建会拿到同一个 id,新节点继承旧节点的流量档位(同周期内跨线不报)和抖动状态。每轮巡检先按 现存 id 裁剪。从未上报过的节点不再记缺席,否则新装的节点第一次连上就被算作 从一次超过宽限期的掉线回来,头一个小时的掉线要满 30 分钟才报。 signed_in 去掉多余的 to_canonical,client_ip 已经规范化过。
useradd 在 /usr/sbin。Debian 的 su 不带 - 时保留调用者的 PATH(login.defs 未设 ALWAYS_SET_PATH),其中没有 sbin,安装在建用户这一步失败。脚本开头把 /usr/sbin 与 /sbin 追加到 PATH。
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
问题
review #10、#8 时发现四处,均有测试或实测复现。
down_since」,这两条没跟上:节点先跨过 80%、之后才配渠道,这条提醒永远不发;当天 9 点后才配渠道,汇总要等到次日。Watch按节点 id 存,而 id 是 rowid,删掉最新的节点再建一台会拿到同一个 id。实测新节点在同一周期内用量到 90% 不报(继承了旧节点的档位)。su(不带-)切 root 安装失败。 fix: agent 改用固定系统用户,修复部分 LXC 容器启动失败 #8 引入的useradd在/usr/sbin,而 Debian 的login.defs不设ALWAYS_SET_PATH,su保留调用者的 PATH,里面没有 sbin。失败发生在下载与注册之前,不破坏已有节点。修改
src/notify.rsarmed,expiry_digest在没有渠道时提前返回、不写日期。先跨过阈值再配渠道的,配好后下一轮巡检补报一条absent/returned/traffic。一轮(30 秒)之内删了又建仍会继承,代码里用ponytail:标明last_seen = 0的节点不记缺席,离线判定里原有的last_seen > 0随之去掉signed_in去掉多余的to_canonical(),client_ip已经规范化过install.sh:set -eu之后把/usr/sbin:/sbin追加到 PATH。测试
cargo fmt --check、cargo clippy --all-targets(无警告)、cargo test(98 个)通过。a_new_node_starts_with_no_absence_return_or_traffic_step,流量与到期汇总两个测试补上「无渠道 → 配渠道」一段last_seen = 0判断、去掉armed条件,对应测试各自失败install.sh:sh -n通过;PATH=/usr/local/bin:/usr/bin:/bin下command -v useradd找不到,追加后解析到/usr/sbin/useradd兼容
无 schema、接口、agent 协议变化。行为变化只有一处:没配渠道期间跨过的流量阈值,在配好渠道后会补报一次。