Add gopsutil meminfo fields to mem plugin (#4546)

This commit is contained in:
shrug42
2018-08-13 16:41:23 -07:00
committed by Greg
parent 7ca7f22e50
commit 6ad5089361
4 changed files with 66 additions and 3 deletions

View File

@@ -27,6 +27,27 @@ func TestMemStats(t *testing.T) {
// Buffers: 771,
// Cached: 4312,
// Shared: 2142,
CommitLimit: 1,
CommittedAS: 118680,
Dirty: 4,
HighFree: 0,
HighTotal: 0,
HugePageSize: 4096,
HugePagesFree: 0,
HugePagesTotal: 0,
LowFree: 69936,
LowTotal: 255908,
Mapped: 42236,
PageTables: 1236,
Shared: 0,
SwapCached: 0,
SwapFree: 524280,
SwapTotal: 524280,
VMallocChunk: 3872908,
VMallocTotal: 3874808,
VMallocUsed: 1416,
Writeback: 0,
WritebackTmp: 0,
}
mps.On("VMStat").Return(vms, nil)
@@ -47,6 +68,27 @@ func TestMemStats(t *testing.T) {
"inactive": uint64(1124),
"wired": uint64(134),
"slab": uint64(1234),
"commit_limit": uint64(1),
"committed_as": uint64(118680),
"dirty": uint64(4),
"high_free": uint64(0),
"high_total": uint64(0),
"huge_page_size": uint64(4096),
"huge_pages_free": uint64(0),
"huge_pages_total": uint64(0),
"low_free": uint64(69936),
"low_total": uint64(255908),
"mapped": uint64(42236),
"page_tables": uint64(1236),
"shared": uint64(0),
"swap_cached": uint64(0),
"swap_free": uint64(524280),
"swap_total": uint64(524280),
"vmalloc_chunk": uint64(3872908),
"vmalloc_total": uint64(3874808),
"vmalloc_used": uint64(1416),
"write_back": uint64(0),
"write_back_tmp": uint64(0),
}
acc.AssertContainsTaggedFields(t, "mem", memfields, make(map[string]string))