dushixiang
3c4f978395
Refactor agent metrics collection and delivery
2026-07-12 21:00:04 +08:00
dushixiang
828c0b54ca
Remove agent metrics buffer
2026-07-08 22:33:43 +08:00
dushixiang
60678ea1bc
chore: upgrade dependencies
2026-07-08 21:56:14 +08:00
dushixiang
26bd90ed90
升级依赖
2026-05-23 15:51:24 +08:00
dushixiang
8df67c55ba
fixed
2026-05-23 15:45:07 +08:00
dushixiang
ff06e1aecb
fix: sort offline monitors last
2026-05-23 15:36:23 +08:00
dushixiang
c8ef936a71
feat: add agent expire alerts
2026-05-23 15:32:46 +08:00
dushixiang
0e670a82a0
修复默认 ip_trust_list 格式不正确的问题
2026-05-23 15:01:50 +08:00
dushixiang
d3690832f9
优化发布构建资源加载
2026-05-07 21:45:22 +08:00
dushixiang
e3dcdb73cc
remove docker agent
2026-05-07 21:11:37 +08:00
dushixiang
af50627d9b
Adjust server list refresh interval
2026-05-07 21:10:13 +08:00
dushixiang
f9e2de81ef
fix: prevent agent version column collapse
2026-05-07 20:59:15 +08:00
dushixiang
ac80cdc7b8
add postgres driver
2026-05-07 08:05:39 +08:00
dushixiang and Claude Opus 4.7
a6b70e33a9
修复网络连接图表 TS 编译错误,使用类型守卫替代不安全的类型断言
...
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com >
2026-05-06 23:42:46 +08:00
dushixiang and Claude Opus 4.7
fe388df67d
Windows 下 ICMP 探测改用 ping.exe,避开 raw socket 权限限制
...
pro-bing 在 Windows 上必须 SetPrivileged(true) 走原始套接字,普通账号
没有权限会直接失败。按平台拆分实现:unix 继续走 pro-bing,windows 调
系统 ping 并以 TTL= 作为跨语言锚点解析输出;同时校验 target 防止被
ping.exe 当作 flag 解析。
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com >
2026-05-06 23:39:40 +08:00
dushixiang
304b113c3b
升级依赖,修复 macOS arm64 温度采集导致的 bug
2026-05-06 23:30:42 +08:00
dushixiang and Claude Opus 4.7
c431f300bc
新增实时监控模式,agent 1s 并行采集 + 前端滑动窗口
...
agent
- 移除 collector.interval 配置项;按指标类型内置节奏:cpu/memory/network/
disk_io/gpu/network_connection 1s,temperature 5s,disk 30s,host 60s
- doCollectAndSend 改为并行执行本 tick 到期的采集器,避免串行累计耗时
超过 1s 节奏;每个 goroutine 加 recover 兜底,单点 panic 不拖垮整 tick
server
- LatestMetrics 加 sync.RWMutex + Update/Snapshot 方法,HandleMetricData
所有写入走 Update;GetLatestMetrics 返回 Snapshot,handler 在副本上
sanitize,修复 marshal 时与 ws 写入的 data race(go test -race 验证)
- HandleMetricData defer Set 缓存项,每次上报刷新 TTL;host case 也走
Update,不再 1 小时后失效
- LatestMetrics.Timestamp 用服务端 time.Now(),agent 时钟倒拨不会冻结
前端实时图;Timestamp/DiskIOSummary 字段补到 LatestMetrics
- AutoStep 新增 r ≤ 5m → 1s 档;timeRangeMilliseconds 加 2m
frontend
- 详情页加"实时"档位(默认),1s 拉 latestMetrics + 1m 历史播种 + 滑动
2 分钟窗口;快图表(CPU/Memory/Network/DiskIO/NetworkConnection)走
useLiveBuffer 追加,慢图表(GPU/Temperature/Monitor)保留 refetch
- useLiveBuffer:seed 不再覆盖已追加的 livePoint;resetKey 处理切网卡 /
切 agent 时的语义复位
- formatChartTime live 档位精确到秒;修复 1d/24h 仅显示 HH:mm 跨夜歧义
- 慢图表用 React.memo,阻断 1Hz 节奏的级联重渲染
- GpuChart 修复 utilization/temperature 时间戳错位时温度点丢失
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com >
2026-05-06 23:18:50 +08:00
dushixiang
e115d828ab
重构数据采集打包,修改为统一打包发送
2026-05-05 17:46:32 +08:00
dushixiang
29d8b3e9cf
调整指标数据使用 max 聚合,避免消峰
2026-05-05 17:09:26 +08:00
dushixiang
77967a37cd
修复告警记录间隔不对的问题
2026-05-05 16:25:16 +08:00
dushixiang
911269ce12
Merge pull request #82 from yumusb/main
...
Enhance API Key management and improve user experience
2026-05-05 10:05:30 +08:00
yumusb
cfde75e21e
fix: 磁盘采集支持多硬盘,修复只采集系统盘的问题
...
- 默认采集所有真实存储设备而非仅根分区
- 通过设备路径白名单识别真实磁盘(块设备/网络存储)
- 排除 tmpfs、proc、cgroup 等虚拟文件系统
- 排除 macOS APFS 冗余系统卷(Preboot/VM/Update 等)
2026-04-30 14:37:58 +08:00
yumusb
47c9a515a2
feat: 支持短UUID访问服务器详情,前端默认使用短链接
...
- 后端支持通过UUID前缀(第一段)匹配探针,保留完整UUID兼容
- 注册时自动检测短ID前缀冲突,冲突时分配新UUID
- 前端列表和卡片默认链接到短UUID(前8位)
2026-04-30 14:10:39 +08:00
yumusb
9c113a0bab
feat: 通信密钥管理页面增加部署指南入口
...
- 在 PageHeader 添加"部署指南"按钮
- 点击跳转到探针一键安装页面
- 使用 Terminal 图标,提升用户体验
2026-04-24 20:16:17 +08:00
yumusb
f53f2caa91
feat: 探针部署页面增加创建通信密钥按钮
...
- 一键安装和手动安装页面均添加"创建密钥"按钮
- 点击按钮直接弹出创建通信密钥弹窗,无需跳转
- 创建成功后自动选中新密钥并刷新密钥列表
- 创建完成后显示成功提示和完整密钥值
- 优化密钥选择区域布局,按钮和标题并排显示
2026-04-24 19:27:27 +08:00
yumusb
242d2690c2
fix: 修复安装页面体验问题
...
- 服务端地址和自定义名称改为受控 Input,输入即更新安装命令
- 服务端地址保存增加独立"保存"按钮和 loading 状态
- 通信密钥入口链接改为 react-router Link,避免整页刷新
- 复制密钥按钮增加行级 loading 状态,防止重复点击
2026-04-24 19:20:28 +08:00
yumusb
89b5dbf2d5
fix: 修复服务监控列表右侧留白
2026-04-24 19:11:13 +08:00
yumusb
951b19edeb
fix: 管理后台认证失效时跳转登录
2026-04-24 18:45:02 +08:00
yumusb
9ff0d2acc1
feat: 添加通信密钥与管理 API Key 前端管理
2026-04-24 18:45:01 +08:00
yumusb
52a30aae74
feat: 支持 API Key 类型与管理接口认证
2026-04-24 18:45:01 +08:00
dushixiang
e952a5a67f
Merge pull request #80 from yumusb/main
...
一些优化
2026-04-22 14:55:09 +08:00
yumusb and Claude Opus 4.7
c2e64804f3
fix: GPU 采集器 nvidia-smi 调用添加 15 秒超时
...
nvidia-smi 在 GPU 驱动异常时可能无限挂起,导致整个 metricsLoop 卡死。
使用 exec.CommandContext 为 initStatic 和 collectDynamic 中的 nvidia-smi
调用添加 15 秒超时保护。
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com >
2026-04-20 14:43:16 +08:00
yumusb and Claude Opus 4.7
e0c9fc5b25
fix: 修复 Agent 卡死不触发重连的问题
...
Agent 在连接断开后完全卡死 17 小时,根因分析如下:
1. 并发写竞争:pingLoop 直接使用 rawConn.WriteControl 与 metricsLoop
的 safeConn.WriteJSON 竞争同一个 gorilla websocket 内部锁
2. 连接写失败被吞掉:outboundWriter.WriteJSON 写失败时返回 nil,
metricsLoop 感知不到连接错误,不会触发重连
3. 采集器无超时保护:任何采集器阻塞都会冻结整个 metricsLoop
修复:
- safeConn 新增 WriteControl 方法,pingLoop 改用 safeConn 写入
- outboundWriter.WriteJSON 写失败时返回真实错误
- collectAndSendAllMetrics 增加 30 秒全局超时保护
- 连接写失败视为连接异常,返回错误触发重连
- 新增采集耗时监控日志(耗时超过 500ms 时记录)
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com >
2026-04-20 14:43:06 +08:00
yumusb and Claude Opus 4.7
7069c8ba6b
fix: pika-agent log 命令在 journal 为空时自动回退到日志文件
...
当 systemd journal 被轮转清空时,pika-agent log 只显示 -- No entries --,
不会回退到 agent 自己的日志文件。修复后 Linux 平台会先检查 journal 内容,
为空时自动切换到读取 ~/.pika/logs/agent.log。
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com >
2026-04-20 14:42:51 +08:00
yumusb and Claude Opus 4.6
d56251a4e7
fix: 移除会话失效时强制跳转登录页的行为
...
前端在检测到 401 或本地无 token 时不再自动跳转到 /login,
改为仅清理本地缓存并抛出错误,由调用方自行决定后续行为。
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com >
2026-04-15 20:38:11 +08:00
yumusb and Claude Opus 4.6
ab22f9bd57
fix: 修复指标采集空数据时误报0%的问题
...
当磁盘或网卡采集不到有效数据时,空列表会被写入缓存导致
磁盘占用率和网络流量显示为0%,与真实值混淆。
修复方案:
- Agent端:空列表不发送,与GPU/温度采集器保持一致
- Server端:空数据时跳过缓存更新,保留上一次有效值
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com >
2026-04-14 20:30:54 +08:00
yumusb and Claude Opus 4.6
155ce40ee2
feat: 添加 pika log 命令用于快速查看 Agent 日志
...
支持实时跟踪(-f)、指定行数(-n)、强制查看服务日志(-s)等选项,
兼容 Linux (journalctl)、macOS (log show)、Windows (PowerShell)。
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com >
2026-04-14 20:15:05 +08:00
yumusb
b504a704a6
Update CyberCard.tsx
2026-04-10 21:21:59 +08:00
yumusb and Claude Opus 4.6
e91d1a106b
fix: Agent 安装时自动清理已存在的旧服务
...
重新安装 Agent 时如果服务已存在会报错
"Init already exists: /etc/systemd/system/pika-agent.service"
修改 Install() 方法,判断错误类型:
- 如果是"服务已存在"错误,先停止卸载旧服务再重装
- 其他错误(如权限不足)直接返回
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com >
2026-04-10 16:42:08 +08:00
dushixiang
ed828a83d3
Merge pull request #79 from yumusb/main
...
优化监控展示、告警服务和前端交互
2026-04-10 16:18:25 +08:00
yumusb and Claude Opus 4.6
9c1752bb4d
fix: 删除探针时清理内存缓存中的监控数据
...
删除探针时只清理了 VictoriaMetrics 时序数据,但没有清理内存中的监控缓存,
导致监控页面显示已删除探针的 agent_id (hash) 作为名称。
- 新增 CleanAgentFromMonitorCache 方法遍历清理监控缓存
- 新增 DeleteAgentLatestMetricsCache 方法清理探针指标缓存
- DeleteAgent 删除探针时增加清理内存缓存步骤
- CleanOrphanedAgentMetrics 手动清理时也清理内存缓存
- 前端隐藏"清理残留指标数据"按钮(已自动清理无需手动操作)
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com >
2026-04-10 16:14:04 +08:00
yumusb and Claude Opus 4.6
d4a42c6f22
feat: 优化前端 UI 交互
...
- 添加操作加载状态
- 表格支持水平滚动
- 优化多个页面组件展示
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com >
2026-04-10 12:53:21 +08:00
yumusb and Claude Opus 4.6
b9ec210542
refactor: 优化后端服务结构
...
- 统一使用 orz 响应格式
- 优化 handler 和 service 层代码
- 改进上下文传递
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com >
2026-04-10 12:53:13 +08:00
yumusb and Claude Opus 4.6
85a55af6a5
feat: 优化监控图表展示
...
- 增强 MonitorChart 组件功能和样式
- 优化 ResponseTimeChart 图表显示
- 添加可选择图例功能
- 统一图表插值和 connectNulls 配置
- 优化 MiniChart 和 MonitorCard 展示
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com >
2026-04-10 12:53:04 +08:00
yumusb and Claude Opus 4.6
ffd1461b80
feat: 优化通知和告警服务
...
- 重构告警通知逻辑
- 新增通知队列服务
- 优化告警信息处理
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com >
2026-04-10 12:52:50 +08:00
yumusb and Claude Opus 4.6
d915ce1c15
feat: 优化打包配置
...
- 优化 GitHub Actions 构建流程
- 优化 Makefile 构建配置
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com >
2026-04-10 12:52:40 +08:00
yumusb
ce7478b004
打包体积优化
2026-04-08 21:23:24 +08:00
yumusb
3919340d85
Update notifier.go
2026-04-08 21:15:31 +08:00
yumusb
fd452e56d8
增加测试镜像、增加删除残留数据。
2026-04-08 20:24:03 +08:00
dushixiang
2ffb315eb7
Merge pull request #78 from yumusb/main
...
Support metric bundles and enable WS compression
2026-04-08 11:35:12 +08:00