Skip to content

Instantly share code, notes, and snippets.

@stefanfoulis
Last active September 15, 2015 15: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 stefanfoulis/7edb9ca769897f703847 to your computer and use it in GitHub Desktop.
Save stefanfoulis/7edb9ca769897f703847 to your computer and use it in GitHub Desktop.
super naive open files check for datadog
from checks import AgentCheck
class FileDescriptorCheck(AgentCheck):
def check(self, instance):
with open('/proc/sys/fs/file-nr', 'r') as fobj:
fd_open, unknown, fd_max = fobj.read().split('\t')
self.gauge('system.fd_open', int(fd_open))
self.gauge('system.fd_max', int(fd_max))
self.gauge('system.fd_open_pct', float(fd_open)/float(fd_max))
init_config:
nothing: 0
instances:
[{}]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment