更新工作区配置,删除不再使用的Cloudflare相关文件,优化日志输出格式,增强主机信息收集功能,调整代码结构以提高可维护性。
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
package cmd
|
||||
|
||||
import (
|
||||
"agent-wdd/config"
|
||||
"agent-wdd/host_info"
|
||||
|
||||
"github.com/spf13/cobra"
|
||||
)
|
||||
@@ -13,7 +13,7 @@ func addInfoSubcommands(cmd *cobra.Command) {
|
||||
Use: "os",
|
||||
Short: "主机操作系统相关的信息",
|
||||
Run: func(cmd *cobra.Command, args []string) {
|
||||
os := config.ConfigCache.Agent.OS
|
||||
os := host_info.ConfigCache.Agent.OS
|
||||
os.Gather()
|
||||
|
||||
os.SaveConfig()
|
||||
@@ -25,7 +25,7 @@ func addInfoSubcommands(cmd *cobra.Command) {
|
||||
Use: "network",
|
||||
Short: "主机Network相关的信息",
|
||||
Run: func(cmd *cobra.Command, args []string) {
|
||||
network := config.ConfigCache.Agent.Network
|
||||
network := host_info.ConfigCache.Agent.Network
|
||||
network.Gather()
|
||||
network.SaveConfig()
|
||||
},
|
||||
@@ -36,7 +36,7 @@ func addInfoSubcommands(cmd *cobra.Command) {
|
||||
Use: "cpu",
|
||||
Short: "主机cpu相关的信息",
|
||||
Run: func(cmd *cobra.Command, args []string) {
|
||||
cpu := config.ConfigCache.Agent.CPU
|
||||
cpu := host_info.ConfigCache.Agent.CPU
|
||||
cpu.Gather()
|
||||
cpu.Save()
|
||||
},
|
||||
@@ -47,9 +47,9 @@ func addInfoSubcommands(cmd *cobra.Command) {
|
||||
Use: "mem",
|
||||
Short: "主机memory相关的信息",
|
||||
Run: func(cmd *cobra.Command, args []string) {
|
||||
mem := config.ConfigCache.Agent.Mem
|
||||
mem := host_info.ConfigCache.Agent.Mem
|
||||
mem.Gather()
|
||||
swap := config.ConfigCache.Agent.Swap
|
||||
swap := host_info.ConfigCache.Agent.Swap
|
||||
swap.Gather()
|
||||
|
||||
mem.SaveConfig()
|
||||
@@ -63,10 +63,10 @@ func addInfoSubcommands(cmd *cobra.Command) {
|
||||
Use: "disk",
|
||||
Short: "主机disk相关的信息",
|
||||
Run: func(cmd *cobra.Command, args []string) {
|
||||
//disks := config.ConfigCache.Agent.Disks
|
||||
config.DiskListGather()
|
||||
//disks := host_info.ConfigCache.Agent.Disks
|
||||
host_info.DiskListGather()
|
||||
|
||||
config.DiskListSaveConfig()
|
||||
host_info.DiskListSaveConfig()
|
||||
},
|
||||
}
|
||||
|
||||
@@ -83,7 +83,7 @@ func addInfoSubcommands(cmd *cobra.Command) {
|
||||
disk.Run(cmd, args)
|
||||
|
||||
// 归一化
|
||||
config.ConfigCache.NormalizeConfig()
|
||||
host_info.ConfigCache.NormalizeConfig()
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user