Skip to content

Instantly share code, notes, and snippets.

@HarryR
Created October 27, 2011 09:54
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 HarryR/1319192 to your computer and use it in GitHub Desktop.
Save HarryR/1319192 to your computer and use it in GitHub Desktop.
ServerDensity plugin to graph open file handles
#!/usr/bin/env python
class LinuxProcSysFs:
def __init__(self, agentConfig, checksLogger, rawConfig):
self.agentConfig = agentConfig
self.checksLogger = checksLogger
self.rawConfig = rawConfig
def run(self):
x = open('/proc/sys/fs/file-nr', 'r').readline().split()
return {
'open': x[0],
'free': x[1],
'max_open': x[2]
}
return x
if __name__ == "__main__":
lpsf = LinuxProcSysFs(None, None, None)
print lpsf.run()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment