mirror of
https://github.com/prometheus/node_exporter.git
synced 2024-12-27 14:39:53 -08:00
Fix accidently empty lines in meminfo_linux (#1671)
* Fix accidently empty lines in meminfo_linux Signed-off-by: qwertysun <qwertysun@tencent.com>
This commit is contained in:
parent
bd0918f29a
commit
fa4edd700e
|
@ -45,6 +45,10 @@ func parseMemInfo(r io.Reader) (map[string]float64, error) {
|
|||
for scanner.Scan() {
|
||||
line := scanner.Text()
|
||||
parts := strings.Fields(line)
|
||||
// Workaround for empty lines occasionally occur in CentOS 6.2 kernel 3.10.90.
|
||||
if len(parts) == 0 {
|
||||
continue
|
||||
}
|
||||
fv, err := strconv.ParseFloat(parts[1], 64)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("invalid value in meminfo: %s", err)
|
||||
|
|
Loading…
Reference in a new issue