Commit Graph
450 Commits
Author SHA1 Message Date
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
yumusbandClaude 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
yumusbandClaude 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
yumusbandClaude 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
yumusbandClaude 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
yumusbandClaude 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
yumusbandClaude 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
yumusbandClaude 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
yumusbandClaude 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
yumusbandClaude Opus 4.6 d4a42c6f22 feat: 优化前端 UI 交互
- 添加操作加载状态
- 表格支持水平滚动
- 优化多个页面组件展示

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

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-10 12:52:50 +08:00
yumusbandClaude 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
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 修复告警恢复当前值不正确的问题 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 优化探针重连逻辑 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. 优化首页流量展示方式
2026-02-10 19:56:46 +08:00
dushixiang 31619096b8 修改所有上报断线缓存 + 最多保留 24 小时 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
Hoin 71df7fb583 fix(agent): 排除 tap 开头的虚拟接口以避免误采集
在默认网络接口排除规则和示例配置中添加对 tap 开头接口的排除,这些是 PVE/KVM 虚拟机使用的虚拟网卡,不应纳入网络指标采集范围。
2026-01-31 11:04:43 +08:00
dushixiang fa70172e5c Merge pull request #68 from zmf963/main
修复GPU监控显示问题
2026-01-30 15:14:21 +08:00
zmf96 03abd50988 修复GPU监控显示问题 2026-01-30 14:45:14 +08:00
dushixiang dcf16c5e6d Merge pull request #67 from yumusb/main
优化告警消息
2026-01-29 20:27:35 +08:00
yumusb 7f922e7382 优化告警消息
优化告警消息,IP去重以及增加监控项的名称
2026-01-29 19:20:09 +08:00
dushixiang 2c5dc16d9b 修复编译前端失败的问题 2026-01-25 22:10:20 +08:00
dushixiang 7f40150644 修复编译前端失败的问题 2026-01-25 22:07:40 +08:00
dushixiang 0032266374 update README.md 2026-01-25 22:04:28 +08:00
dushixiang c9b6d6ff5a 优化流量统计 2026-01-25 22:01:56 +08:00
dushixiang 43732e57e2 优化设备详情网络地址的展示,服务监控的默认增加默认排序。 2026-01-25 21:21:46 +08:00
dushixiang 3f3ddfea49 通知增加通信 IP 的展示,移除自定义 Webhook 的默认 json form 模版 fix #42 2026-01-25 21:02:09 +08:00