Last active
September 15, 2015 15:54
-
-
Save stefanfoulis/7edb9ca769897f703847 to your computer and use it in GitHub Desktop.
super naive open files check for datadog
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
init_config: | |
nothing: 0 | |
instances: | |
[{}] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment