Esempio n. 1
0
def init_config(do_log=True):
    # init default search path
    config.add_search_path("/etc/datadog-agent")
    config.add_search_path(os.path.join(DEFAULT_PATH, "etc/datadog-agent"))
    config.add_search_path("./etc/datadog-agent")
    config.add_search_path(".")
    try:
        config.load()
    except Exception:
        if do_log:
            initialize_logging('agent')
        raise

    # init log
    if do_log:
        initialize_logging('agent')

    # add file provider
    file_provider = FileConfigProvider()
    file_provider.add_place(
        os.path.join(os.path.dirname(config.get_loaded_config()), 'conf.d'))
    file_provider.add_place(os.path.join(config.get('conf_path'), 'conf.d'))
    file_provider.add_place(config.get('additional_checksd'))
    config.add_provider('file', file_provider)

    # FIXME: perhaps do this elsewhere
    config.collect_check_configs()
Esempio n. 2
0
def init_agent():
    # init default search path
    config.add_search_path("/etc/datadog-unix-agent")
    config.add_search_path(".")
    config.load()

    # init log
    level = logging.getLevelName(config.get("log_level").upper())
    logging.basicConfig(level=level)

    # add file provider
    file_provider = FileConfigProvider()
    file_provider.add_place(config.get('additional_checksd'))
    config.add_provider('file', file_provider)

    # FIXME: do this elsewhere
    # collect config
    config.collect_check_configs()