Read swap statistics only if swap stats enabled
This commit is contained in:
@@ -38,6 +38,7 @@ func (c *MyConfig) UpdateMemStats() {
|
||||
continue
|
||||
}
|
||||
|
||||
if c.Mem.ShowSwap {
|
||||
sw, err := mem.SwapMemory()
|
||||
|
||||
if err != nil {
|
||||
@@ -47,7 +48,6 @@ func (c *MyConfig) UpdateMemStats() {
|
||||
continue
|
||||
}
|
||||
|
||||
if c.Mem.ShowSwap {
|
||||
if c.Values.Memory.Usedpct != uint64(v.UsedPercent) || c.Values.Memory.Shared != v.Shared/1024/1024 || c.Values.Memory.Swap != sw.Used/1024/1024 {
|
||||
c.Values.Memory.Usedpct = uint64(v.UsedPercent)
|
||||
c.Values.Memory.Shared = v.Shared / 1024 / 1024
|
||||
|
||||
Reference in New Issue
Block a user