feat: 完善堡垒机与 Agent 智能运维能力
- 支持 Windows Agent 构建、安装脚本和统一上报协议 - 增强 RDP 剪贴板、虚拟盘和文件传输能力 - 新增 AIOps 上下文工具、告警 RCA trace 落库和回放接口 - 重构 docs 模块文档并补充终端、堡垒机、监控、AI Agent 设计
This commit is contained in:
1 parent
a9513c2056
commit
e0d652d211
169 files changed
+12192
-9116
No files matched your search
@@ -0,0 +1,56 @@
|
||||
//go:build windows
|
||||
|
||||
// Package collector 实现 Windows 系统静态信息采集。 // Logan.Li
|
||||
package collector
|
||||
|
||||
import (
|
||||
"os/exec"
|
||||
"strings"
|
||||
)
|
||||
|
||||
type SystemInfo struct {
|
||||
OSVersion string
|
||||
Kernel string
|
||||
UptimeSeconds int64
|
||||
}
|
||||
|
||||
func CollectSystem() SystemInfo {
|
||||
return SystemInfo{
|
||||
OSVersion: windowsOSCaption(),
|
||||
Kernel: windowsVersion(),
|
||||
UptimeSeconds: windowsUptime(),
|
||||
}
|
||||
}
|
||||
|
||||
func windowsOSCaption() string {
|
||||
out, err := exec.Command("powershell.exe", "-NoProfile", "-Command", "(Get-CimInstance Win32_OperatingSystem).Caption").Output()
|
||||
if err != nil {
|
||||
return "Windows"
|
||||
}
|
||||
if s := strings.TrimSpace(string(out)); s != "" {
|
||||
return s
|
||||
}
|
||||
return "Windows"
|
||||
}
|
||||
|
||||
func windowsVersion() string {
|
||||
out, err := exec.Command("cmd.exe", "/C", "ver").Output()
|
||||
if err != nil {
|
||||
return ""
|
||||
}
|
||||
return strings.TrimSpace(string(out))
|
||||
}
|
||||
|
||||
func windowsUptime() int64 {
|
||||
out, err := exec.Command("powershell.exe", "-NoProfile", "-Command", "[int]((Get-Date) - (Get-CimInstance Win32_OperatingSystem).LastBootUpTime).TotalSeconds").Output()
|
||||
if err != nil {
|
||||
return 0
|
||||
}
|
||||
var n int64
|
||||
for _, ch := range strings.TrimSpace(string(out)) {
|
||||
if ch >= '0' && ch <= '9' {
|
||||
n = n*10 + int64(ch-'0')
|
||||
}
|
||||
}
|
||||
return n
|
||||
}
|
||||
Reference in new issue
Block a user