|
|
@ -52,7 +52,7 @@ func parseNetDevStats(r io.Reader, ignore *regexp.Regexp) (map[string]map[string
|
|
|
|
|
|
|
|
|
|
|
|
receiveHeader := strings.Fields(parts[1])
|
|
|
|
receiveHeader := strings.Fields(parts[1])
|
|
|
|
transmitHeader := strings.Fields(parts[2])
|
|
|
|
transmitHeader := strings.Fields(parts[2])
|
|
|
|
headerLength := len(receiveHeader)+len(transmitHeader)+1
|
|
|
|
headerLength := len(receiveHeader) + len(transmitHeader) + 1
|
|
|
|
|
|
|
|
|
|
|
|
netDev := map[string]map[string]string{}
|
|
|
|
netDev := map[string]map[string]string{}
|
|
|
|
for scanner.Scan() {
|
|
|
|
for scanner.Scan() {
|
|
|
@ -68,13 +68,13 @@ func parseNetDevStats(r io.Reader, ignore *regexp.Regexp) (map[string]map[string
|
|
|
|
continue
|
|
|
|
continue
|
|
|
|
}
|
|
|
|
}
|
|
|
|
netDev[dev] = map[string]string{}
|
|
|
|
netDev[dev] = map[string]string{}
|
|
|
|
for i := 0; i < len(receiveHeader); i++ {
|
|
|
|
for i := 0; i < len(receiveHeader); i++ {
|
|
|
|
netDev[dev]["receive_"+receiveHeader[i]] = parts[i+1]
|
|
|
|
netDev[dev]["receive_"+receiveHeader[i]] = parts[i+1]
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
for i := 0; i < len(transmitHeader); i++ {
|
|
|
|
for i := 0; i < len(transmitHeader); i++ {
|
|
|
|
netDev[dev]["transmit_"+transmitHeader[i]] = parts[i+1+len(receiveHeader)]
|
|
|
|
netDev[dev]["transmit_"+transmitHeader[i]] = parts[i+1+len(receiveHeader)]
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return netDev, scanner.Err()
|
|
|
|
return netDev, scanner.Err()
|
|
|
|
}
|
|
|
|
}
|
|
|
|