Files
komari-agent/monitoring/unit/gpu_detailed_fallback.go
kdwycz 5304a68d5d 新增Linux GPU监控功能
参考了nezha-agent。实现了Linux服务器下NVIDIA显卡的监控。
通过 --gpu 参数启用显卡监控功能。
支持多显卡,显卡使用率,显存使用率监控
实现了AMD显卡的监控,但是未经过测试
2025-09-12 16:09:55 +08:00

32 lines
1.0 KiB
Go

//go:build !linux
package monitoring
import (
"errors"
)
// DetailedGPUInfo 详细GPU信息结构体
type DetailedGPUInfo struct {
Name string `json:"name"` // GPU型号
MemoryTotal uint64 `json:"memory_total"` // 总显存 (字节)
MemoryUsed uint64 `json:"memory_used"` // 已用显存 (字节)
Utilization float64 `json:"utilization"` // GPU使用率 (0-100)
Temperature uint64 `json:"temperature"` // 温度 (摄氏度)
}
// GetDetailedGPUHost 获取GPU型号信息 - 回退实现
func GetDetailedGPUHost() ([]string, error) {
return nil, errors.New("detailed GPU monitoring not supported on this platform")
}
// GetDetailedGPUState 获取GPU使用率 - 回退实现
func GetDetailedGPUState() ([]float64, error) {
return nil, errors.New("detailed GPU monitoring not supported on this platform")
}
// GetDetailedGPUInfo 获取详细GPU信息 - 回退实现
func GetDetailedGPUInfo() ([]DetailedGPUInfo, error) {
return nil, errors.New("detailed GPU monitoring not supported on this platform")
}