Fix ret.CPU detection on various platforms (#16)
This commit is contained in:
parent
6aae5d4936
commit
833398cca0
@ -67,11 +67,15 @@ func GetHost(agentConfig *model.AgentConfig) *model.Host {
|
||||
if err != nil {
|
||||
println("cpu.Info error:", err)
|
||||
} else {
|
||||
for i := 0; i < len(ci); i++ {
|
||||
cpuModelCount[ci[i].ModelName]++
|
||||
}
|
||||
for model, count := range cpuModelCount {
|
||||
ret.CPU = append(ret.CPU, fmt.Sprintf("%s %d %s Core", model, count, cpuType))
|
||||
if runtime.GOOS == "linux" || runtime.GOOS == "windows" {
|
||||
for i := 0; i < len(ci); i++ {
|
||||
cpuModelCount[ci[i].ModelName]++
|
||||
}
|
||||
for model, count := range cpuModelCount {
|
||||
ret.CPU = append(ret.CPU, fmt.Sprintf("%s %d %s Core", model, count, cpuType))
|
||||
}
|
||||
} else {
|
||||
ret.CPU = append(ret.CPU, fmt.Sprintf("%s %d %s Core", ci[0].ModelName, ci[0].Cores, cpuType))
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user