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

scollector: include slab as free mem for linux os.mem #2250

merged 2 commits into from May 16, 2018


Copy link

@kylebrandt kylebrandt commented May 15, 2018

This mimics the free command: "cache Memory used by the page cache and slabs (Cached and Slab in /proc/meminfo)"

This mimics the free command: "cache Memory used by the page cache and slabs (Cached and Slab in /proc/meminfo)"
Add(&md, osMemTotal, int(mem["MemTotal"])*1024, nil, metadata.Gauge, metadata.Bytes, osMemTotalDesc)
Add(&md, osMemFree, (int(mem["MemFree"])+int(mem["Buffers"])+int(mem["Cached"]))*1024, nil, metadata.Gauge, metadata.Bytes, osMemFreeDesc)
Add(&md, osMemUsed, (int(mem["MemTotal"])-(int(mem["MemFree"])+int(mem["Buffers"])+int(mem["Cached"])))*1024, nil, metadata.Gauge, metadata.Bytes, osMemUsedDesc)
bufferCacheSlab := mem["Buffers"] + mem["Cached"] + mem["Slab"]

This comment has been minimized.


captncraig May 16, 2018

A lot of repetition of mem["stringConstant"] here. Would it make sense to define a few variables and reuse them?

@kylebrandt kylebrandt merged commit 98f88d6 into master May 16, 2018
1 of 3 checks passed
1 of 3 checks passed
bosun tests fail.
continuous-integration/travis-ci/push The Travis CI build failed
continuous-integration/travis-ci/pr The Travis CI build passed
@kylebrandt kylebrandt deleted the linux_mem branch Jun 28, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

2 participants
You can’t perform that action at this time.