Skip to content

Commit fa4edd7

Browse files
authored
Fix accidently empty lines in meminfo_linux (prometheus#1671)
* Fix accidently empty lines in meminfo_linux Signed-off-by: qwertysun <qwertysun@tencent.com>
1 parent bd0918f commit fa4edd7

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

collector/meminfo_linux.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,10 @@ func parseMemInfo(r io.Reader) (map[string]float64, error) {
4545
for scanner.Scan() {
4646
line := scanner.Text()
4747
parts := strings.Fields(line)
48+
// Workaround for empty lines occasionally occur in CentOS 6.2 kernel 3.10.90.
49+
if len(parts) == 0 {
50+
continue
51+
}
4852
fv, err := strconv.ParseFloat(parts[1], 64)
4953
if err != nil {
5054
return nil, fmt.Errorf("invalid value in meminfo: %s", err)

0 commit comments

Comments
 (0)