diff --git a/collectors/memstatMetric.go b/collectors/memstatMetric.go index fb21ffb..3449ce1 100644 --- a/collectors/memstatMetric.go +++ b/collectors/memstatMetric.go @@ -84,7 +84,7 @@ func getStats(filename string) map[string]MemstatStats { case 5: v, err := strconv.ParseFloat(linefields[3], 64) if err == nil { - cclog.ComponentDebug("getStats", strings.Trim(linefields[2], ":"), v, linefields[4]) + cclog.ComponentDebug("MemstatCollector", strings.Trim(linefields[2], ":"), v, linefields[4]) stats[strings.Trim(linefields[2], ":")] = MemstatStats{ value: v, unit: linefields[4], @@ -92,6 +92,9 @@ func getStats(filename string) map[string]MemstatStats { } } } + if scanner.Err() != nil { + cclog.ComponentError("MemstatCollector", "Failed to get memory stats") + } return stats } @@ -247,12 +250,6 @@ func (m *MemstatCollector) Read(interval time.Duration, output chan lp.CCMessage unit = cacheVal.unit } } - if shmemVal, shmem := stats["Shmem"]; shmem { - memUsed -= shmemVal.value - if len(shmemVal.unit) > 0 && len(unit) == 0 { - unit = shmemVal.unit - } - } } } }