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

Modularize metric checks #121

Merged
merged 1 commit into from
Jul 25, 2012
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions checks/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
except ImportError: # Python < 2.5
from md5 import new as md5

import modules

from config import get_version

from checks import gethostname
Expand Down Expand Up @@ -109,6 +111,13 @@ def __init__(self, agentConfig, emitters):
Varnish(self.checksLogger),
ElasticSearch(self.checksLogger),
]
for module_spec in [s.strip() for s in self.agentConfig.get('custom_checks', '').split(',')]:
if len(module_spec) == 0: continue
try:
self._metrics_checks.append(modules.load(module_spec, 'Check')(self.checksLogger))
except Exception:
self.checksLogger.error('Unable to load custom check module %r', module_spec, exc_info=True)

self._event_checks = [Hudson(), Nagios(socket.gethostname())]
self._resources_checks = [ResProcesses(self.checksLogger,self.agentConfig)]

Expand Down
20 changes: 18 additions & 2 deletions datadog.conf.example
Original file line number Diff line number Diff line change
Expand Up @@ -321,11 +321,27 @@ use_mount: no

# Comma-separated list of emitters to be used in addition to the standard one
#
# Expected to be passed as a colon-separated file (or module) / classname list.
# Expected to be passed as a comma-separated list of colon-delimited
# name/object pairs.
#
# custom_emitters: /usr/local/my-code/emitters/rabbitmq.py:RabbitMQEmitter
#
# If the name of the emitter function is not classed, 'emitter' is assumed.
# If the name of the emitter function is not specified, 'emitter' is assumed.


# ========================================================================== #
# Custom Checks
# ========================================================================== #

# Comma-separated list of additional metric checks
#
# Expected to be passed as a comma-separated list of colon-delimited
# name/object pairs.
#
# custom_checks: /usr/local/my-code/checks/foo.py:FooCheck
#
# If the name of the check is not specified, 'Check' is assumed.



# -------------------------------------------------------------------------- #
Expand Down