Skip to content

Instantly share code, notes, and snippets.

@gwillem
Created May 26, 2015 10:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gwillem/b61e8c33c9bfc9ec76f1 to your computer and use it in GitHub Desktop.
Save gwillem/b61e8c33c9bfc9ec76f1 to your computer and use it in GitHub Desktop.
Inode monitoring for Server Density
import os
class DiskInodes(object):
def __init__(self, agent_config, checksLogger, rawConfig):
self.agent_config = agent_config
self.checks_logger = checksLogger
self.raw_config = rawConfig
def run(self, path='/data'):
datastat = os.statvfs(path)
total, free = datastat.f_files, datastat.f_ffree
used = total - free
# server density accepts floats or ints only
percfree = round(float(used) / total * 100, 1)
# print used, free, total, percfree
return {path: percfree}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment