Commit Graph

6 Commits

Author SHA1 Message Date
shirainbown
1c0fce6a17 feat: independent SSH sync service with concurrency limit
- Split SSH sync from ping loop into independent service
- Ping service: serial polling, 30s interval, only updates online status
- SSH sync service: runs every 10 minutes for all online machines
- Global semaphore limits concurrent SSH to 2 (prevents resource exhaustion)
- SSH command timeout 8s prevents hanging on unresponsive hosts
- Offline machines are skipped for SSH sync
- Ping fallback: if ping fails but SSH succeeds, mark as online (SSH sync handles info)
2026-06-19 18:21:36 +08:00
shirainbown
74bab47a5b feat: optimize ping interval to 30s and SSH sync to 10min with timeout protection
- Change ping interval from 60s to 30s (configurable via PING_INTERVAL)
- Change SSH info sync from every ping to every 10 minutes (via ssh_synced_at)
- Add SSH command timeout (8s) to prevent hanging on unresponsive hosts
- Add concurrency limit (5) for SSH sync operations
- Change frontend UI refresh interval from 10s to 30s
- Fix: remove hardcoded 30s step, use configured interval directly
- Fix: ensure ping loop continues even if individual machine fails
2026-06-19 18:08:06 +08:00
shirainbown
6f507b319e feat: merge PVE VM management + local features
- Merge PVE (Proxmox VE) virtual machine management from remote
  - PVE host CRUD API
  - VM status query / start / stop operations
  - PVE database tables and models
  - Frontend VM status display and control buttons
  - SPA routing fix for nested asset paths

- Keep local features:
  - Change password functionality
  - Log cleanup service
  - Docker containerization (Dockerfile + docker-compose)
  - Empty machine ping log spam fix
  - settings table for admin password storage

- Update machines handlers to support PVE fields
- Update frontend API client with PVE endpoints
2026-06-18 22:33:45 +08:00
shirainbown
d34ed5842a feat: SSH 成功获取系统信息时视为机器在线
在连通性检测逻辑中,当 network ping / ICMP / TCP 三层探测均失败后,
若机器配置了 SSH 凭据,则同步尝试调用 GetSSHInfo 进行 SSH 信息采集:
- 若 SSH 采集成功,则将该机器判定为在线,并保存获取到的系统信息;
- 若 SSH 采集也失败,则保持离线状态,按原逻辑记录离线日志。

此改进可避免以下场景导致的误判:
- 机器禁 ping 或 ICMP 被防火墙拦截;
- SSH 端口未被网络层探测正确识别;
- 只要 SSH 服务正常且能正确登录并获取系统信息,即认为机器处于可用状态。

其他改动:
- 提取 saveSSHResult 辅助函数,统一保存 SSH 采集结果,避免重复代码。
- 同步更新了本地与 Linux 部署二进制文件。
2026-04-15 01:39:16 +08:00
shirainbown
1a5f5ee3b5 feat: 机器离线统计/日志、连通性重试检测与暗黑模式支持
后端更新:
- 在 machines 表新增 offline_count、total_offline_seconds、last_offline_at、last_offline_reason 字段,用于记录机器离线统计信息。
- 新增 offline_logs 表,记录每次离线的开始时间、结束时间、持续时长及离线原因。
- 重写 ping 服务为状态机模式:
  – 单台机器依次使用 system ping / ICMP / TCP(SSH端口) 三种方式检测连通性;
  – 任意一次成功即视为在线;
  – 若一次失败,则会连续重试 3 次(间隔 2 秒),3 次均失败才判定为离线,避免网络抖动导致误判。
  – 仅在状态发生 online→offline 或 offline→online 变化时更新 offline_logs 与累计时长。
  – 机器按顺序逐个检测,每台间隔 30 秒。
- 新增 API:GET /admin/machines/:id/offline-logs,用于查询最近 50 条离线记录。
- CleanupLogs 增加对 offline_logs 的过期清理。

前端更新:
- 机器详情页(MachineDetail.vue)新增离线统计卡片,展示离线次数、累计离线时长、上次离线原因及最近 5 条离线记录。
- 全局支持暗黑模式:
  – App.vue 引入 light/dark CSS 变量,并加载 Element Plus 深色主题(dark/css-vars.css)。
  – MainLayout.vue 侧边栏新增主题切换按钮,支持深浅色切换并持久化到 localStorage。
  – Topology.vue 监听主题变化,动态重绘 G6 节点/边的颜色、背景与阴影。
  – MachineList.vue / MachineDetail.vue 全面适配深色变量(卡片、表格、标签、进度条等)。
- 机器列表卡片 UI 调整:改为顶部 OS 色点 + 在线/离线状态胶囊标签,离线卡片降低透明度并去色。

构建与部署:
- 重新构建前端并打包静态资源。
- 交叉编译 Linux amd64 二进制并更新 deploy/lan-manager-debian12.tar.gz 部署包。
2026-04-15 01:34:06 +08:00
shirainbown
d28aae585f Initial commit: LAN Manager with Go backend and Vue frontend 2026-04-15 00:52:25 +08:00