mirror of
https://github.com/ClusterCockpit/cc-metric-collector.git
synced 2026-08-12 10:27:14 +02:00
MemstatCollector: remove mem_shared from mem_used calculation. Fixes #226
This commit is contained in:
@@ -84,7 +84,7 @@ func getStats(filename string) map[string]MemstatStats {
|
|||||||
case 5:
|
case 5:
|
||||||
v, err := strconv.ParseFloat(linefields[3], 64)
|
v, err := strconv.ParseFloat(linefields[3], 64)
|
||||||
if err == nil {
|
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{
|
stats[strings.Trim(linefields[2], ":")] = MemstatStats{
|
||||||
value: v,
|
value: v,
|
||||||
unit: linefields[4],
|
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
|
return stats
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -247,12 +250,6 @@ func (m *MemstatCollector) Read(interval time.Duration, output chan lp.CCMessage
|
|||||||
unit = cacheVal.unit
|
unit = cacheVal.unit
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if shmemVal, shmem := stats["Shmem"]; shmem {
|
|
||||||
memUsed -= shmemVal.value
|
|
||||||
if len(shmemVal.unit) > 0 && len(unit) == 0 {
|
|
||||||
unit = shmemVal.unit
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user