Files
membank/auto-check/cmd/root.go
张威33321 0a0e5fdf7f 0822
2026-08-22 17:19:47 +08:00

36 lines
813 B
Go
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
package cmd
import (
"fmt"
"os"
"github.com/spf13/cobra"
)
var (
configFile string // 配置文件路径
)
var rootCmd = &cobra.Command{
Use: "auto-check",
Short: "自动化设备发现 + SSH 登录 + 远程压力测试工具",
Long: `auto-check 是一个自动化运维工具,支持:
1. 目标扫描发现存活设备(支持 CIDR 和 IP 范围格式)
2. 自动 SSH 登录验证
3. 远程执行压力测试CPU/内存/磁盘/网络)
配置仅从配置文件加载(默认 ./auto-check.yaml`,
}
func init() {
rootCmd.PersistentFlags().StringVar(&configFile, "config", "", "配置文件路径 (默认: ./auto-check.yaml)")
}
// Execute 入口:加载配置并启动
func Execute() {
if err := rootCmd.Execute(); err != nil {
fmt.Fprintln(os.Stderr, err)
os.Exit(1)
}
}