Files
membank/auto-check
12600k-rog-d4 ab81cee9b0 fix(discovery): support Chinese ping output and decode GBK
- parsePingReply now matches both 'received =' (English) and 'received =' (Chinese) so devices are detected correctly on non-English Windows

- decode ping stdout from GBK to UTF-8

- remove raw ping log output

- add golang.org/x/text dependency
2026-08-13 02:05:32 +08:00
..

auto-check

自动化网段扫描 + SSH 登录 + 远程压力测试工具。

基于 cobra 命令行框架。

功能

子命令 功能
run 完整流程:发现 → SSH → 压测 全部
scan 仅扫描网段,发现存活设备 pkg/discovery
stress 对指定 IP 执行压力测试 pkg/stress + pkg/sshclient

安装

go build -o auto-check .

使用

# 查看帮助
./auto-check --help

# 仅扫描网段
./auto-check scan --cidr 192.168.1.0/24

# 对指定主机执行压力测试
./auto-check stress --ips 192.168.1.100,192.168.1.101 --user root --password secret --stress cpu,memory,disk

# 完整流程(扫描 → SSH → 压测)
./auto-check run --cidr 192.168.1.0/24 --user root --password secret --stress cpu,memory,disk

全局标志

标志 默认值 说明
--cidr 192.168.1.0/24 目标网段 (CIDR)
--user root SSH 用户名
--password (空) SSH 密码
--key (空) SSH 私钥路径
--port 22 SSH 端口
--timeout 3s 超时
--concurrency 50 并发扫描数
--report (自动生成) 报告输出路径

子命令标志

run / stress

标志 默认值 说明
--stress cpu,memory 压测类型: cpu, memory, disk, memnative, full
--duration 30s 持续时间
--threads 4 线程数
--ips (必填,仅stress) 目标 IP (逗号分隔)

压力测试类型

类型 工具 说明
cpu stress-ng CPU 全方法压测
memory stress-ng 内存压测
disk stress-ng 磁盘IO混合压测
memnative stressapptest 内存稳定性精压(数据完整性校验)
full stress-ng CPU+内存+磁盘 三合一综合压测

项目结构

auto-check/
├── main.go
├── cmd/
│   └── root.go              # 所有子命令
├── pkg/
│   ├── discovery/           # 设备发现
│   ├── sshclient/           # SSH 客户端
│   ├── stress/              # 压力测试
│   │   ├── types.go         # 类型定义
│   │   ├── tools.go         # 工具检测 + 监控
│   │   ├── runners.go       # 压测实现
│   │   └── runner.go        # 调度器
│   └── report/              # 报告模块
├── go.mod
└── README.md

⚠️ 请在授权设备上使用,未授权扫描/测试可能违反法律法规。