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

Rather than grabbing in_use from df, calculate for precision #1785

Merged
merged 1 commit into from
Jul 27, 2015

Conversation

JohnLZeller
Copy link
Contributor

Currently, for our manual checks, we are just grabbing the percentage for disk in_use from the output of df. This produces a percentage with no decimal precision. To improve this precision, let's calculate the disk in_use metric ourselves based on the free and used values supplied by df. This calculation is consistent with how df calculates disk usage, but isn't rounded up.

Calculation: <disk_used> / (<disk_used> + <disk_free>)

Further Proof:
We don't calculate in_use as (<disk_used> / <disk_total>), because <disk_total> includes reserved space that is inaccessable by the user. Calculating this way would produce a misleading value that is of a lower percentage than what df shows.

@remh
Copy link

remh commented Jul 27, 2015

Looks good to me. Thanks!

remh pushed a commit that referenced this pull request Jul 27, 2015
Rather than grabbing in_use from df, calculate for precision
@remh remh merged commit 345cde1 into master Jul 27, 2015
@LeoCavaille LeoCavaille deleted the zeller/disk-check-2 branch August 11, 2015 19:00
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.

2 participants