Fixed find_packages, remove . from package name

This commit is contained in:
Tim Kuhlman 2014-05-12 16:02:07 -06:00
parent 06dbf96434
commit 46184a850b
47 changed files with 29 additions and 29 deletions

View File

@ -122,7 +122,7 @@ class Collector(object):
def run(self): def run(self):
""" """
Collect data from each check and submit their data. Collect data from each check and submit their data.
There are currently two types of checks the system checks and the configured ones from checks.d There are currently two types of checks the system checks and the configured ones from checks_d
""" """
timer = Timer() timer = Timer()
if self.os != 'windows': if self.os != 'windows':
@ -147,7 +147,7 @@ class Collector(object):
for check_type in self._checks: for check_type in self._checks:
metrics_list.extend(check_type.check()) metrics_list.extend(check_type.check())
# checks.d checks # checks_d checks
checks_d_metrics, checks_d_events, checks_statuses = self.run_checks_d() checks_d_metrics, checks_d_events, checks_statuses = self.run_checks_d()
metrics_list.extend(checks_d_metrics) metrics_list.extend(checks_d_metrics)
events.update(checks_d_events) events.update(checks_d_events)
@ -167,7 +167,7 @@ class Collector(object):
self._set_status(checks_statuses, emitter_statuses, collect_duration) self._set_status(checks_statuses, emitter_statuses, collect_duration)
def run_checks_d(self): def run_checks_d(self):
""" Run defined checks.d checks. """ Run defined checks_d checks.
returns a list of Measurements, a dictionary of events and a list of check statuses. returns a list of Measurements, a dictionary of events and a list of check statuses.
""" """
measurements = [] measurements = []

View File

@ -246,7 +246,7 @@ class Cacti(AgentCheck):
''' '''
For backwards compatability with pre-checks.d configuration. For backwards compatability with pre-checks_d configuration.
Convert old-style config to new-style config. Convert old-style config to new-style config.
''' '''
@staticmethod @staticmethod

View File

@ -101,7 +101,7 @@ class CollectorDaemon(Daemon):
if config is None: if config is None:
config = get_config(parse_args=True) config = get_config(parse_args=True)
# Load the checks.d checks # Load the checks_d checks
checksd = load_check_directory(config) checksd = load_check_directory(config)
self.collector = Collector(config, http_emitter, checksd) self.collector = Collector(config, http_emitter, checksd)
@ -264,7 +264,7 @@ def main():
# Try the old-style check first # Try the old-style check first
print getattr(collector.checks.collector, check_name)(log).check(agentConfig) print getattr(collector.checks.collector, check_name)(log).check(agentConfig)
except Exception: except Exception:
# If not an old-style check, try checks.d # If not an old-style check, try checks_d
checks = load_check_directory(agentConfig) checks = load_check_directory(agentConfig)
for check in checks['initialized_checks']: for check in checks['initialized_checks']:
if check.name == check_name: if check.name == check_name:

View File

@ -345,7 +345,7 @@ class CollectorStatus(AgentStatus):
lines.append(' System UTC time: ' + datetime.datetime.utcnow().__str__()) lines.append(' System UTC time: ' + datetime.datetime.utcnow().__str__())
lines.append('') lines.append('')
# Paths to checks.d/conf.d # Paths to checks_d/conf.d
lines += [ lines += [
'Paths', 'Paths',
'=====', '=====',
@ -365,7 +365,7 @@ class CollectorStatus(AgentStatus):
checksd_path = 'Not found' checksd_path = 'Not found'
lines.append(' conf.d: ' + confd_path) lines.append(' conf.d: ' + confd_path)
lines.append(' checks.d: ' + checksd_path) lines.append(' checks_d: ' + checksd_path)
lines.append('') lines.append('')
# Hostnames # Hostnames

View File

@ -105,11 +105,11 @@ def _windows_checksd_path():
if hasattr(sys, 'frozen'): if hasattr(sys, 'frozen'):
# we're frozen - from py2exe # we're frozen - from py2exe
prog_path = os.path.dirname(sys.executable) prog_path = os.path.dirname(sys.executable)
checksd_path = os.path.join(prog_path, '..', 'checks.d') checksd_path = os.path.join(prog_path, '..', 'checks_d')
else: else:
cur_path = os.path.dirname(__file__) cur_path = os.path.dirname(__file__)
checksd_path = os.path.join(cur_path, '../collector/checks.d') checksd_path = os.path.join(cur_path, '../collector/checks_d')
if os.path.exists(checksd_path): if os.path.exists(checksd_path):
return checksd_path return checksd_path
@ -134,9 +134,9 @@ def _unix_confd_path():
def _unix_checksd_path(): def _unix_checksd_path():
# Unix only will look up based on the current directory # Unix only will look up based on the current directory
# because checks.d will hang with the other python modules # because checks_d will hang with the other python modules
cur_path = os.path.dirname(os.path.realpath(__file__)) cur_path = os.path.dirname(os.path.realpath(__file__))
checksd_path = os.path.join(cur_path, '../collector/checks.d') checksd_path = os.path.join(cur_path, '../collector/checks_d')
if os.path.exists(checksd_path): if os.path.exists(checksd_path):
return checksd_path return checksd_path
@ -197,7 +197,7 @@ def get_config(parse_args=True, cfg_path=None, options=None):
'listen_port': None, 'listen_port': None,
'version': get_version(), 'version': get_version(),
'watchdog': True, 'watchdog': True,
'additional_checksd': '/etc/mon-agent/checks.d/', 'additional_checksd': '/etc/mon-agent/checks_d/',
} }
monstatsd_interval = DEFAULT_STATSD_FREQUENCY monstatsd_interval = DEFAULT_STATSD_FREQUENCY
@ -223,14 +223,14 @@ def get_config(parse_args=True, cfg_path=None, options=None):
# FIXME unnecessarily complex # FIXME unnecessarily complex
# Extra checks.d path # Extra checks_d path
# the linux directory is set by default # the linux directory is set by default
if config.has_option('Main', 'additional_checksd'): if config.has_option('Main', 'additional_checksd'):
agent_config['additional_checksd'] = config.get('Main', 'additional_checksd') agent_config['additional_checksd'] = config.get('Main', 'additional_checksd')
elif get_os() == 'windows': elif get_os() == 'windows':
# default windows location # default windows location
common_path = _windows_commondata_path() common_path = _windows_commondata_path()
agent_config['additional_checksd'] = os.path.join(common_path, 'Datadog', 'checks.d') agent_config['additional_checksd'] = os.path.join(common_path, 'Datadog', 'checks_d')
# Concerns only Windows # Concerns only Windows
if config.has_option('Main', 'use_web_info_page'): if config.has_option('Main', 'use_web_info_page'):
@ -493,7 +493,7 @@ def check_yaml(conf_path):
f.close() f.close()
def load_check_directory(agent_config): def load_check_directory(agent_config):
''' Return the initialized checks from checks.d, and a mapping of checks that failed to ''' Return the initialized checks from checks_d, and a mapping of checks that failed to
initialize. Only checks that have a configuration initialize. Only checks that have a configuration
file in conf.d will be returned. ''' file in conf.d will be returned. '''
from monagent.collector.checks import AgentCheck from monagent.collector.checks import AgentCheck
@ -521,7 +521,7 @@ def load_check_directory(agent_config):
JMXFetch.init(confd_path, agent_config, get_logging_config(), DEFAULT_CHECK_FREQUENCY, JMX_COLLECT_COMMAND) JMXFetch.init(confd_path, agent_config, get_logging_config(), DEFAULT_CHECK_FREQUENCY, JMX_COLLECT_COMMAND)
# For backwards-compatability with old style checks, we have to load every # For backwards-compatability with old style checks, we have to load every
# checks.d module and check for a corresponding config OR check if the old # checks_d module and check for a corresponding config OR check if the old
# config will "activate" the check. # config will "activate" the check.
# #
# Once old-style checks aren't supported, we'll just read the configs and # Once old-style checks aren't supported, we'll just read the configs and
@ -541,9 +541,9 @@ def load_check_directory(agent_config):
if os.path.exists(conf_path): if os.path.exists(conf_path):
# There is a configuration file for that check but the module can't be imported # There is a configuration file for that check but the module can't be imported
init_failed_checks[check_name] = {'error':e, 'traceback':traceback_message} init_failed_checks[check_name] = {'error':e, 'traceback':traceback_message}
log.exception('Unable to import check module %s.py from checks.d' % check_name) log.exception('Unable to import check module %s.py from checks_d' % check_name)
else: # There is no conf for that check. Let's not spam the logs for it. else: # There is no conf for that check. Let's not spam the logs for it.
log.debug('Unable to import check module %s.py from checks.d' % check_name) log.debug('Unable to import check module %s.py from checks_d' % check_name)
continue continue
check_class = None check_class = None
@ -589,7 +589,7 @@ def load_check_directory(agent_config):
log.warn(" ".join(d)) log.warn(" ".join(d))
else: else:
log.debug('No conf.d/%s.yaml found for checks.d/%s.py' % (check_name, check_name)) log.debug('No conf.d/%s.yaml found for checks_d/%s.py' % (check_name, check_name))
continue continue
# Look for the per-check config, which *must* exist # Look for the per-check config, which *must* exist
@ -631,8 +631,8 @@ def load_check_directory(agent_config):
log.debug('Loaded check.d/%s.py' % check_name) log.debug('Loaded check.d/%s.py' % check_name)
log.info('initialized checks.d checks: %s' % initialized_checks.keys()) log.info('initialized checks_d checks: %s' % initialized_checks.keys())
log.info('initialization failed checks.d checks: %s' % init_failed_checks.keys()) log.info('initialization failed checks_d checks: %s' % init_failed_checks.keys())
return {'initialized_checks':initialized_checks.values(), return {'initialized_checks':initialized_checks.values(),
'init_failed_checks':init_failed_checks, 'init_failed_checks':init_failed_checks,
} }

View File

@ -119,7 +119,7 @@ class DDAgent(multiprocessing.Process):
systemStats = get_system_stats() systemStats = get_system_stats()
self.collector = Collector(self.config, emitters, systemStats) self.collector = Collector(self.config, emitters, systemStats)
# Load the checks.d checks # Load the checks_d checks
checksd = load_check_directory(self.config) checksd = load_check_directory(self.config)
# Main agent loop will run until interrupted # Main agent loop will run until interrupted

View File

@ -123,7 +123,7 @@ setup(
install_requires=install_requires, install_requires=install_requires,
setup_requires=setup_requires, setup_requires=setup_requires,
url="https://github.com/hpcloud-mon/mon-agent", url="https://github.com/hpcloud-mon/mon-agent",
packages=find_packages(exclude=['tests']), packages=find_packages(exclude=['tests', 'build*', 'packaging*']),
entry_points={ entry_points={
'console_scripts': [ 'console_scripts': [
'mon-forwarder = monagent.forwarder:main', 'mon-forwarder = monagent.forwarder:main',

View File

@ -49,7 +49,7 @@ class TestElastic(unittest.TestCase):
raise SkipTest("See https://github.com/DataDog/dd-agent/issues/825") raise SkipTest("See https://github.com/DataDog/dd-agent/issues/825")
agent_config = {'elasticsearch': 'http://localhost:%s' % PORT, 'version': '0.1', 'api_key': 'toto'} agent_config = {'elasticsearch': 'http://localhost:%s' % PORT, 'version': '0.1', 'api_key': 'toto'}
# Initialize the check from checks.d # Initialize the check from checks_d
c = load_check('elastic', {'init_config': {}, 'instances': {}}, agent_config) c = load_check('elastic', {'init_config': {}, 'instances': {}}, agent_config)
conf = c.parse_agent_config(agent_config) conf = c.parse_agent_config(agent_config)
self.check = load_check('elastic', conf, agent_config) self.check = load_check('elastic', conf, agent_config)

View File

@ -48,7 +48,7 @@ class HaproxyTestCase(unittest.TestCase):
'api_key': 'toto' 'api_key': 'toto'
} }
# Initialize the check from checks.d # Initialize the check from checks_d
self.check = load_check('haproxy', config, self.agent_config) self.check = load_check('haproxy', config, self.agent_config)
try: try:

View File

@ -35,7 +35,7 @@ class TestMongo(unittest.TestCase):
'api_key': 'toto' 'api_key': 'toto'
} }
# Initialize the check from checks.d # Initialize the check from checks_d
self.check = load_check('mongo', {'init_config': {}, 'instances': {}}, self.agent_config) self.check = load_check('mongo', {'init_config': {}, 'instances': {}}, self.agent_config)
# Start 2 instances of Mongo in a replica set # Start 2 instances of Mongo in a replica set
@ -84,7 +84,7 @@ class TestMongo(unittest.TestCase):
}] }]
} }
# Test mongodb with checks.d # Test mongodb with checks_d
self.check = load_check('mongo', self.config, self.agent_config) self.check = load_check('mongo', self.config, self.agent_config)
# Run the check against our running server # Run the check against our running server

View File

@ -19,7 +19,7 @@ class TestMySql(unittest.TestCase):
'version': '0.1', 'version': '0.1',
'api_key': 'toto' } 'api_key': 'toto' }
# Initialize the check from checks.d # Initialize the check from checks_d
c = load_check('mysql', {'init_config': {}, 'instances': {}}, agent_config) c = load_check('mysql', {'init_config': {}, 'instances': {}}, agent_config)
conf = c.parse_agent_config(agent_config) conf = c.parse_agent_config(agent_config)
self.check = load_check('mysql', conf, agent_config) self.check = load_check('mysql', conf, agent_config)