mirror of
https://github.com/ClusterCockpit/cc-metric-collector.git
synced 2024-11-12 21:17:25 +01:00
Fix format for cpustat collector
This commit is contained in:
parent
e35a9f6b86
commit
e8b2bbdae1
@ -51,13 +51,13 @@ func (m *CpustatCollector) Read(interval time.Duration) {
|
|||||||
|
|
||||||
ll := strings.Split(string(buffer), "\n")
|
ll := strings.Split(string(buffer), "\n")
|
||||||
for _, line := range ll {
|
for _, line := range ll {
|
||||||
if (len(line) == 0) {
|
if len(line) == 0 {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
ls := strings.Fields(line)
|
ls := strings.Fields(line)
|
||||||
if (strings.Compare(ls[0], "cpu") == 0) {
|
if strings.Compare(ls[0], "cpu") == 0 {
|
||||||
ParseStatLine(line, m.node)
|
ParseStatLine(line, m.node)
|
||||||
} else if (strings.HasPrefix(ls[0], "cpu")) {
|
} else if strings.HasPrefix(ls[0], "cpu") {
|
||||||
cpustr := strings.TrimLeft(ls[0], "cpu")
|
cpustr := strings.TrimLeft(ls[0], "cpu")
|
||||||
cpu, _ := strconv.Atoi(cpustr)
|
cpu, _ := strconv.Atoi(cpustr)
|
||||||
ParseStatLine(line, m.cpus[cpu])
|
ParseStatLine(line, m.cpus[cpu])
|
||||||
|
Loading…
Reference in New Issue
Block a user