Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add SReclaimable and SUnreclaim to mem input #6716

Merged
merged 2 commits into from
Nov 25, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Gopkg.toml
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@

[[constraint]]
name = "github.com/shirou/gopsutil"
version = "2.18.12"
version = "2.19.7"

[[constraint]]
name = "github.com/Shopify/sarama"
Expand Down
4 changes: 3 additions & 1 deletion plugins/inputs/mem/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ Available fields are dependent on platform.
- mapped (integer)
- page_tables (integer)
- shared (integer)
- sreclaimable (integer)
- sunreclaim (integer)
- swap_cached (integer)
- swap_free (integer)
- swap_total (integer)
Expand All @@ -54,5 +56,5 @@ Available fields are dependent on platform.

### Example Output:
```
mem active=11347566592i,available=18705133568i,available_percent=89.4288960571006,buffered=1976709120i,cached=13975572480i,commit_limit=14753067008i,committed_as=2872422400i,dirty=87461888i,free=1352400896i,high_free=0i,high_total=0i,huge_page_size=2097152i,huge_pages_free=0i,huge_pages_total=0i,inactive=6201593856i,low_free=0i,low_total=0i,mapped=310427648i,page_tables=14397440i,shared=200781824i,slab=1937526784i,swap_cached=0i,swap_free=4294963200i,swap_total=4294963200i,total=20916207616i,used=3611525120i,used_percent=17.26663449848977,vmalloc_chunk=0i,vmalloc_total=35184372087808i,vmalloc_used=0i,wired=0i,write_back=0i,write_back_tmp=0i 1536704085000000000
mem active=9299595264i,available=16818249728i,available_percent=80.41654254645131,buffered=2383761408i,cached=13316689920i,commit_limit=14751920128i,committed_as=11781156864i,dirty=122880i,free=1877688320i,high_free=0i,high_total=0i,huge_page_size=2097152i,huge_pages_free=0i,huge_pages_total=0i,inactive=7549939712i,low_free=0i,low_total=0i,mapped=416763904i,page_tables=19787776i,shared=670679040i,slab=2081071104i,sreclaimable=1923395584i,sunreclaim=157675520i,swap_cached=1302528i,swap_free=4286128128i,swap_total=4294963200i,total=20913917952i,used=3335778304i,used_percent=15.95004011996231,vmalloc_chunk=0i,vmalloc_total=35184372087808i,vmalloc_used=0i,wired=0i,write_back=0i,write_back_tmp=0i 1574712869000000000
```
2 changes: 2 additions & 0 deletions plugins/inputs/mem/memory.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@ func (s *MemStats) Gather(acc telegraf.Accumulator) error {
"mapped": vm.Mapped,
"page_tables": vm.PageTables,
"shared": vm.Shared,
"sreclaimable": vm.SReclaimable,
"sunreclaim": vm.SUnreclaim,
"swap_cached": vm.SwapCached,
"swap_free": vm.SwapFree,
"swap_total": vm.SwapTotal,
Expand Down
4 changes: 4 additions & 0 deletions plugins/inputs/mem/memory_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ func TestMemStats(t *testing.T) {
Mapped: 42236,
PageTables: 1236,
Shared: 0,
SReclaimable: 1923022848,
SUnreclaim: 157728768,
SwapCached: 0,
SwapFree: 524280,
SwapTotal: 524280,
Expand Down Expand Up @@ -81,6 +83,8 @@ func TestMemStats(t *testing.T) {
"mapped": uint64(42236),
"page_tables": uint64(1236),
"shared": uint64(0),
"sreclaimable": uint64(1923022848),
"sunreclaim": uint64(157728768),
"swap_cached": uint64(0),
"swap_free": uint64(524280),
"swap_total": uint64(524280),
Expand Down