示例#1
0
def get_check_class(agentConfig, check_name):
    """Return the class object for a given check name"""
    from config import get_os, get_checks_places, get_valid_check_class

    osname = get_os()
    checks_places = get_checks_places(osname, agentConfig)
    for check_path_builder in checks_places:
        check_path, _ = check_path_builder(check_name)
        if not os.path.exists(check_path):
            continue

        check_is_valid, check_class, load_failure = get_valid_check_class(check_name, check_path)
        if check_is_valid:
            return check_class

    log.warning('Failed to load the check class for %s.' % check_name)
    return None
示例#2
0
def get_check_class(agentConfig, check_name):
    """Return the class object for a given check name"""
    from config import get_os, get_checks_places, get_valid_check_class

    osname = get_os()
    checks_places = get_checks_places(osname, agentConfig)
    for check_path_builder in checks_places:
        check_path, manifest_path = check_path_builder(check_name)
        is_wheel = not check_path and not manifest_path

        if not (check_path and os.path.exists(check_path)) and not is_wheel:
            continue

        check_is_valid, check_class, load_failure = get_valid_check_class(check_name, check_path, from_site=is_wheel)
        if check_is_valid:
            return check_class

    log.warning('Failed to load the check class for %s.' % check_name)
    return None
def get_check_class(agentConfig, check_name):
    """Return the class object for a given check name"""
    from config import get_os, get_checks_places, get_valid_check_class

    osname = get_os()
    checks_places = get_checks_places(osname, agentConfig)
    for check_path_builder in checks_places:
        check_path, manifest_path = check_path_builder(check_name)
        is_wheel = not check_path and not manifest_path

        if not (check_path and os.path.exists(check_path)) and not is_wheel:
            continue

        check_is_valid, check_class, load_failure = get_valid_check_class(
            check_name, check_path, from_site=is_wheel)
        if check_is_valid:
            return check_class

    log.warning('Failed to load the check class for %s.' % check_name)
    return None