Пример #1
0
def render_dashboard_progress():
    valid_integrations = sorted(get_valid_integrations())
    total_integrations = len(valid_integrations)
    integrations_with_dashboard = 0

    lines = [
        '## Dashboards',
        '',
        '!!! note',
        '    This is not representative of _all_ dashboards, as many exist in legacy locations.',
        '',
        None,
        '',
        '??? check "Completed"',
    ]

    for integration in valid_integrations:
        dashboards_path = os.path.join(get_root(), integration, 'assets',
                                       'dashboards')
        if os.path.isdir(dashboards_path) and len(
                os.listdir(dashboards_path)) > 0:
            integrations_with_dashboard += 1
            status = 'X'
        else:
            status = ' '

        lines.append(f'    - [{status}] {integration}')

    percent = integrations_with_dashboard / total_integrations * 100
    formatted_percent = f'{percent:.2f}'
    lines[5] = f'[={formatted_percent}% "{formatted_percent}%"]'
    return lines
Пример #2
0
def render_dashboard_progress():
    valid_integrations = sorted(get_valid_integrations())
    total_integrations = len(valid_integrations)
    integrations_with_dashboard = 0

    lines = [
        '## Dashboards',
        '',
        '!!! note',
        '    This is not representative of _all_ dashboards, as many exist in legacy locations.',
        '',
        None,
        '',
        '??? check "Completed"',
    ]

    for integration in valid_integrations:
        if has_dashboard(integration):
            integrations_with_dashboard += 1
            status = 'X'
        else:
            status = ' '

        lines.append(f'    - [{status}] {integration}')

    percent = integrations_with_dashboard / total_integrations * 100
    formatted_percent = f'{percent:.2f}'
    lines[5] = f'[={formatted_percent}% "{formatted_percent}%"]'
    return lines
Пример #3
0
def render_dashboard_progress():
    valid_integrations = sorted(
        set(get_valid_integrations()).difference(DASHBOARD_NOT_POSSIBLE))
    total_integrations = len(valid_integrations)
    integrations_with_dashboard = 0

    lines = [
        '## Dashboards',
        '',
        '',
        '',
        '',
        None,
        '',
        '??? check "Completed"',
    ]

    for integration in valid_integrations:
        if 'snmp' in integration:
            continue
        if has_dashboard(integration):
            integrations_with_dashboard += 1
            status = 'X'
        else:
            status = ' '

        lines.append(f'    - [{status}] {integration}')

    percent = integrations_with_dashboard / total_integrations * 100
    formatted_percent = f'{percent:.2f}'
    lines[5] = f'[={formatted_percent}% "{formatted_percent}%"]'
    lines[
        7] = f'??? check "Completed {integrations_with_dashboard}/{total_integrations}"'
    return lines
Пример #4
0
def render_dashboard_progress():
    # Integrations that either do not emit metrics or have a too customer-specific setup to have an OOTBD
    not_possible = {
        'agent_metrics',  # Not for the end user
        'snmp',  # Too custom
        'openmetrics',  # No default metrics
        'pdh_check',  # No default metrics
        'prometheus',  # No default metrics
        'teamcity',  # No metrics
        'windows_service',  # No metrics
        'win32_event_log',  # No metrics
        'wmi_check',  # No default metrics
        'windows_service'  # No metrics
    }
    valid_integrations = sorted(
        set(get_valid_integrations()).difference(not_possible))
    total_integrations = len(valid_integrations)
    integrations_with_dashboard = 0

    lines = [
        '## Dashboards',
        '',
        '',
        '',
        '',
        None,
        '',
        '??? check "Completed"',
    ]

    for integration in valid_integrations:
        if 'snmp' in integration:
            continue
        if has_dashboard(integration):
            integrations_with_dashboard += 1
            status = 'X'
        else:
            status = ' '

        lines.append(f'    - [{status}] {integration}')

    percent = integrations_with_dashboard / total_integrations * 100
    formatted_percent = f'{percent:.2f}'
    lines[5] = f'[={formatted_percent}% "{formatted_percent}%"]'
    lines[
        7] = f'??? check "Completed {integrations_with_dashboard}/{total_integrations}"'
    return lines
Пример #5
0
def http():
    """Validate all integrations for usage of http wrapper."""

    has_failed = False
    echo_info("Validating all integrations for usage of http wrapper...")
    for check in sorted(get_valid_integrations()):
        check_uses_http_wrapper = False

        # Validate use of http wrapper (self.http.[...]) in check's .py files
        if check not in EXCLUDED_INTEGRATIONS:
            check_uses_http_wrapper = validate_use_http_wrapper(check)

        # Validate use of http template in check's spec.yaml (if exists)
        if check_uses_http_wrapper:
            has_failed = validate_config_http(get_default_config_spec(check), check) or has_failed

    if has_failed:
        abort()

    echo_success('Completed http validation!')
Пример #6
0
def render_manifest_v2_progress():
    valid_checks = get_valid_integrations()
    total_checks = len(valid_checks)
    checks_v2_manifest = 0

    lines = ['## Manifest V2', '', None, '', '??? check "Completed"']

    for check in valid_checks:
        if is_manifest_v2(check):
            checks_v2_manifest += 1
            status = 'X'
        else:
            status = ' '

        lines.append(f'    - [{status}] {check}')

    percent = checks_v2_manifest / total_checks * 100
    formatted_percent = f'{percent:.2f}'
    lines[2] = f'[={formatted_percent}% "{formatted_percent}%"]'
    lines[4] = f'??? check "Completed {checks_v2_manifest}/{total_checks}"'
    return lines