461 Commits

Author SHA1 Message Date
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
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
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
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
d56251a4e7 fix: 移除会话失效时强制跳转登录页的行为
前端在检测到 401 或本地无 token 时不再自动跳转到 /login,
改为仅清理本地缓存并抛出错误,由调用方自行决定后续行为。

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-15 20:38:11 +08:00
yumusb
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
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
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
优化监控展示、告警服务和前端交互
v0.1.8
2026-04-10 16:18:25 +08:00
yumusb
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
d4a42c6f22 feat: 优化前端 UI 交互
- 添加操作加载状态
- 表格支持水平滚动
- 优化多个页面组件展示

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-10 12:53:21 +08:00
yumusb
b9ec210542 refactor: 优化后端服务结构
- 统一使用 orz 响应格式
- 优化 handler 和 service 层代码
- 改进上下文传递

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-10 12:53:13 +08:00
yumusb
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
ffd1461b80 feat: 优化通知和告警服务
- 重构告警通知逻辑
- 新增通知队列服务
- 优化告警信息处理

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-10 12:52:50 +08:00
yumusb
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
yumusb
35becefe1e Support metric bundles and enable WS compression
Add support for bundling metrics and enable WebSocket compression. Introduces protocol.BundlePayload and MessageTypeBundle, and handles bundled messages on the server side (handleBundleMessage) by iterating items and forwarding each to metricService.HandleMetricData. On the agent side, add bundleWriter to collect outgoing MetricsPayloads, switch collectors to write into the bundle writer, and send a single bundle message when items exist. Also enable compression on the WebSocket upgrader and create a custom websocket.Dialer (with Proxy, HandshakeTimeout and EnableCompression). Minor logging/messages and import adjustments included.
2026-04-08 11:26:00 +08:00
dushixiang
6ba52a1850 修复告警恢复当前值不正确的问题 v0.1.7 2026-02-25 15:13:41 +08:00
dushixiang
4df28e3536 删除探针、服务监控时同步删除 victoriametrics 数据 2026-02-25 14:28:11 +08:00
dushixiang
1a64b27af6 移除原心跳配置和业务,改为使用 WebSocket Ping Pong 实现,并增加超时逻辑 2026-02-25 14:11:22 +08:00
dushixiang
0032e42905 优化探针重连逻辑 v0.1.6 2026-02-24 19:48:28 +08:00
dushixiang
b41e86b251 Merge pull request #74 from yumusb/main
Hide agent IP when unauthenticated
2026-02-24 13:02:13 +08:00
yumusb
63cdd37b12 Hide agent IP when unauthenticated
Ensure agent.IP is cleared for unauthenticated requests. Previously IPv4, IPv6 and Hostname were redacted, but agent.IP was left intact and could leak sensitive information. This change sets agent.IP to an empty string in Get() when the user is not authenticated.
2026-02-24 09:44:27 +08:00
dushixiang
d40fc1314f 1. 修改注册探针的服务端地址为手动填写
2. 优化 Linux 系统服务模板
3. 优化首页流量展示方式
v0.1.5
2026-02-10 19:56:46 +08:00
dushixiang
31619096b8 修改所有上报断线缓存 + 最多保留 24 小时 v0.1.4 2026-02-07 20:15:40 +08:00
dushixiang
47b4ca35e2 修改文档 2026-02-07 18:26:47 +08:00
dushixiang
69a6c3b453 优化 DDNS 的列表操作按钮 2026-02-07 16:00:43 +08:00
dushixiang
a6f09ce997 修复 GPU 配色不正确的问题 fix #61 2026-02-07 15:40:48 +08:00
dushixiang
e82046ac89 强完善默认的虚拟网卡过滤规则 fix #64 2026-02-07 15:30:30 +08:00
dushixiang
3db7118258 强制更新公网 IPv4 和 IPv6 信息 fix #65 2026-02-07 15:24:40 +08:00
dushixiang
4368af9a59 移除多余的 CSS fix #73 2026-02-07 15:15:59 +08:00
dushixiang
855ff37321 回退 Logo 2026-02-07 11:45:21 +08:00
dushixiang
37d2058600 Merge pull request #69 from Hoinor/main
fix(agent): 排除PVE虚拟机 tap 开头的虚拟网卡,以避免虚拟机流量影响PVE宿主机监控数据。
2026-01-31 11:40:44 +08:00