def test_metadata(aggregator, mocked_request, datadog_agent):
    instance = HDFS_NAMENODE_CONFIG['instances'][0]
    hdfs_namenode = HDFSNameNode('hdfs_namenode', {}, [instance])

    # Run the check once
    hdfs_namenode.check_id = CHECK_ID
    hdfs_namenode.check(instance)

    aggregator.assert_service_check(HDFSNameNode.JMX_SERVICE_CHECK,
                                    HDFSNameNode.OK,
                                    tags=HDFS_NAMESYSTEM_METRIC_TAGS +
                                    CUSTOM_TAGS,
                                    count=1)

    major, minor, patch = HDFS_RAW_VERSION.split('.')

    version_metadata = {
        'version.raw': HDFS_RAW_VERSION,
        'version.scheme': 'semver',
        'version.major': major,
        'version.minor': minor,
        'version.patch': patch,
    }

    datadog_agent.assert_metadata(CHECK_ID, version_metadata)
    datadog_agent.assert_metadata_count(5)
def test_check(aggregator, mocked_request):
    instance = HDFS_NAMENODE_CONFIG['instances'][0]
    hdfs_namenode = HDFSNameNode('hdfs_namenode', {}, [instance])

    # Run the check once
    hdfs_namenode.check(instance)

    aggregator.assert_service_check(HDFSNameNode.JMX_SERVICE_CHECK,
                                    HDFSNameNode.OK,
                                    tags=HDFS_NAMESYSTEM_METRIC_TAGS +
                                    CUSTOM_TAGS,
                                    count=1)

    for metric, value in iteritems(HDFS_NAMESYSTEM_STATE_METRICS_VALUES):
        aggregator.assert_metric(metric,
                                 value=value,
                                 tags=HDFS_NAMESYSTEM_METRIC_TAGS +
                                 CUSTOM_TAGS,
                                 count=1)

    for metric, value in iteritems(HDFS_NAMESYSTEM_METRICS_VALUES):
        aggregator.assert_metric(metric,
                                 value=value,
                                 tags=HDFS_NAMESYSTEM_METRIC_TAGS +
                                 CUSTOM_TAGS,
                                 count=1)

    for metric, value in iteritems(HDFS_NAMESYSTEM_MUTUAL_METRICS_VALUES):
        aggregator.assert_metric(metric,
                                 value=value,
                                 tags=HDFS_NAMESYSTEM_METRIC_TAGS +
                                 CUSTOM_TAGS,
                                 count=2)

    aggregator.assert_all_metrics_covered()
Exemple #3
0
def test_check(aggregator, mocked_request):
    hdfs_namenode = HDFSNameNode('hdfs_namenode', {}, {})

    # Run the check once
    hdfs_namenode.check(HDFS_NAMENODE_CONFIG['instances'][0])

    for metric, value in HDFS_NAMESYSTEM_STATE_METRICS_VALUES.iteritems():
        aggregator.assert_metric(metric,
                                 value=value,
                                 tags=HDFS_NAMESYSTEM_METRIC_TAGS,
                                 count=1)

    for metric, value in HDFS_NAMESYSTEM_METRICS_VALUES.iteritems():
        aggregator.assert_metric(metric,
                                 value=value,
                                 tags=HDFS_NAMESYSTEM_METRIC_TAGS,
                                 count=1)

    for metric, value in HDFS_NAMESYSTEM_MUTUAL_METRICS_VALUES.iteritems():
        aggregator.assert_metric(metric,
                                 value=value,
                                 tags=HDFS_NAMESYSTEM_METRIC_TAGS,
                                 count=2)

    aggregator.assert_all_metrics_covered()
def test_auth(aggregator, mocked_auth_request):
    hdfs_namenode = HDFSNameNode('hdfs_namenode', {}, {})

    # Run the check once
    hdfs_namenode.check(HDFS_NAMENODE_AUTH_CONFIG['instances'][0])

    aggregator.assert_service_check(
        HDFSNameNode.JMX_SERVICE_CHECK, HDFSNameNode.OK, tags=HDFS_NAMESYSTEM_METRIC_TAGS + CUSTOM_TAGS, count=1
    )
Exemple #5
0
def check():
    return lambda instance: HDFSNameNode('hdfs_datanode', {}, [instance])
Exemple #6
0
def check():
    return HDFSNameNode("hdfs_namenode", {}, {})