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

[swap stats] add swap in/out check to checks.d #1549

Merged
merged 2 commits into from
Apr 16, 2015
Merged

Conversation

talwai
Copy link
Contributor

@talwai talwai commented Apr 16, 2015

Uses psutil to collect the rate of memory swapped in and swapped out. New metrics are labelled system.swap.swapped_in and system.swap.swapped_out.

Fixes #716

return {}

swap_mem = psutil.swap_memory()
self.gauge('system.swap.swapped_in', swap_mem.sin / B2MB)
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You should use a rate for these.
According to the psutil documentation, sin is

the number of bytes the system has swapped in from disk (cumulative)

By submitting the metric as a rate, you will compute the # of bytes per second swapped in.
Otherwise the graphs will just display a monotonically increasing value.

Also you should submit this value in bytes as per our discussion earlier.

@remh remh added this to the 5.4.0 milestone Apr 16, 2015
from checks import AgentCheck
import psutil

B2MB = float(1048576)
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks like it's not needed anymore :)

@talwai talwai force-pushed the talwai/swap_stats branch from 2963984 to ff718ac Compare April 16, 2015 17:56
@remh
Copy link

remh commented Apr 16, 2015

That looks great! 💥
Tiny last nitpick, could you add a comment to your PR explaining what's it's trying to solve and how please ?

@LeoCavaille
Copy link
Member

👍

@LeoCavaille
Copy link
Member

You should also use a "Fixes #716" expression to link that to currently opened issues.

@talwai talwai force-pushed the talwai/swap_stats branch from ff718ac to 52f11f3 Compare April 16, 2015 18:42
talwai added a commit that referenced this pull request Apr 16, 2015
[swap stats] add swap in/out check to checks.d
@talwai talwai merged commit 8aaa6da into master Apr 16, 2015
@talwai talwai deleted the talwai/swap_stats branch May 13, 2015 22:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Agent should collect system swap metrics
3 participants