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

[disk] AgentCheck for Disk metrics 🎉 #1596

Merged
merged 3 commits into from
May 19, 2015

Conversation

degemer
Copy link
Member

@degemer degemer commented May 6, 2015

This commit is the first step towards the annihilation of the old Check
hidden in checks/system/{unix,win32}.py!
It's time to launch the final assault of Check. AgentCheck shall triumph!

Add a checks.d/disk.py checks, which uses psutil when available to get
disk metrics (same than the previous disk checks), and otherwise
get the same metrics with df.
It has a small integration test, just to check that metrics exist, and
more precise mock tests.
This new check is enabled by default, and the old disk checks are
deleted.

Fix #568

@degemer degemer added this to the 5.4.0 milestone May 6, 2015
@degemer degemer force-pushed the quentin/disk-check-filesystem branch 2 times, most recently from dcd56e1 to 85b24b2 Compare May 6, 2015 22:14
@degemer degemer changed the title [wip][disk] AgentCheck for Disk metrics 🎉 [disk] AgentCheck for Disk metrics 🎉 May 6, 2015
@degemer degemer force-pushed the quentin/disk-check-filesystem branch 8 times, most recently from 4be7581 to 25d3acc Compare May 14, 2015 18:34
list devices. A 'device' is a list with fields corresponding to the
output of df output on each platform.
"""
all_devices = [l.strip().split() for l in df_output.split("\n")]
Copy link

Choose a reason for hiding this comment

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

I know it doesn't matter in this case as it's only for linux but you should use:

df_output.splitlines()

instead. It's better practice as it should work on all platforms.

@degemer degemer force-pushed the quentin/disk-check-filesystem branch 2 times, most recently from bd11bf1 to cba96b7 Compare May 14, 2015 21:29
@degemer
Copy link
Member Author

degemer commented May 14, 2015

I addressed all your comments, moved _load_conf to __init__ (it would be nice to put everything in init_config, but we wouldn't have instances, and I guess the check would not run so...).
Also:

  • collect_* actually send metrics (self.gauge),
  • _collect_* returns dictionary of metrics -> value.

@degemer degemer force-pushed the quentin/disk-check-filesystem branch from cba96b7 to 4d31fd1 Compare May 19, 2015 14:18
@LeoCavaille
Copy link
Member

Thanks for making the updates. Merging.

degemer added 3 commits May 19, 2015 18:03
This commit is the first step towards the annihilation of the old `Check`
hidden in `checks/system/{unix,win32}.py`!
It's time to launch the final assault of `Check`. `AgentCheck` shall triumph!

Add a `checks.d/disk.py` checks, which uses psutil when available to get
disk metrics (same than the previous `disk` checks), and otherwise
get the same metrics with `df`.
It has a small integration test, just to check that metrics exist, and
more precise mock tests.
This new check is enabled by default, and the old `disk` checks are
disabled.
@LeoCavaille LeoCavaille force-pushed the quentin/disk-check-filesystem branch from 4d31fd1 to c85eadf Compare May 19, 2015 22:04
@LeoCavaille LeoCavaille merged commit c85eadf into master May 19, 2015
@LeoCavaille LeoCavaille deleted the quentin/disk-check-filesystem branch May 19, 2015 22:04
@coveralls
Copy link

Coverage Status

Changes Unknown when pulling c85eadf on quentin/disk-check-filesystem into ** on master**.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Allow to exclude filesystems from metrics reporting
4 participants