Exemple #1
0
def test_osd_status_metrics(_, aggregator):

    ceph_check = Ceph(CHECK_NAME, {}, {})
    ceph_check.check(copy.deepcopy(BASIC_CONFIG))

    expected_metrics = [
        'ceph.read_op_per_sec', 'ceph.write_op_per_sec', 'ceph.op_per_sec'
    ]

    for osd, pct_used in [('osd1', 94), ('osd2', 95)]:
        expected_tags = EXPECTED_TAGS + ['ceph_osd:%s' % osd]
        aggregator.assert_metric('ceph.osd.pct_used',
                                 value=pct_used,
                                 count=1,
                                 tags=expected_tags)

    aggregator.assert_metric('ceph.num_full_osds',
                             value=1,
                             count=1,
                             tags=EXPECTED_TAGS)
    aggregator.assert_metric('ceph.num_near_full_osds',
                             value=1,
                             count=1,
                             tags=EXPECTED_TAGS)

    for pool in ['rbd', 'scbench']:
        expected_tags = EXPECTED_TAGS + ['ceph_pool:%s' % pool]
        for metric in expected_metrics:
            aggregator.assert_metric(metric, count=1, tags=expected_tags)
Exemple #2
0
def test_luminous_osd_full_metrics(_, aggregator):

    ceph_check = Ceph(CHECK_NAME, {}, {})
    ceph_check.check(copy.deepcopy(BASIC_CONFIG))

    aggregator.assert_metric('ceph.num_full_osds', value=1)
    aggregator.assert_metric('ceph.num_near_full_osds', value=1)
def test_warn_health(_, aggregator):
    ceph_check = Ceph(CHECK_NAME, {}, {})
    ceph_check.check(copy.deepcopy(BASIC_CONFIG))

    for metric in EXPECTED_METRICS:
        aggregator.assert_metric(metric, count=1, tags=EXPECTED_TAGS)

    aggregator.assert_service_check('ceph.overall_status', status=Ceph.WARNING, tags=EXPECTED_SERVICE_TAGS)
def test_luminous_warn_health(_, aggregator):
    ceph_check = Ceph(CHECK_NAME, {}, {})
    config = copy.deepcopy(BASIC_CONFIG)
    config["collect_service_check_for"] = ['OSD_NEARFULL', 'OSD_FULL']
    ceph_check.check(config)

    aggregator.assert_service_check('ceph.overall_status', status=Ceph.CRITICAL, tags=EXPECTED_SERVICE_TAGS)
    aggregator.assert_service_check('ceph.osd_nearfull', status=Ceph.WARNING, tags=EXPECTED_SERVICE_TAGS)
    aggregator.assert_service_check('ceph.osd_full', status=Ceph.CRITICAL, tags=EXPECTED_SERVICE_TAGS)
Exemple #5
0
def test_luminous_ok_health(_, aggregator):

    ceph_check = Ceph(CHECK_NAME, {}, {})
    config = copy.deepcopy(BASIC_CONFIG)
    config["collect_service_check_for"] = ['OSD_NEARFULL']
    ceph_check.check(config)

    aggregator.assert_service_check('ceph.overall_status', status=Ceph.OK)
    aggregator.assert_service_check('ceph.osd_nearfull', status=Ceph.OK)
    aggregator.assert_service_check('ceph.pool_app_not_enabled', count=0)
Exemple #6
0
def test_osd_perf_with_osdstats(_, aggregator):

    ceph_check = Ceph(CHECK_NAME, {}, {})
    ceph_check.check(copy.deepcopy(BASIC_CONFIG))

    for osd in ['osd0', 'osd1', 'osd2']:
        expected_tags = EXPECTED_TAGS + ['ceph_osd:%s' % osd]

        for metric in ['ceph.commit_latency_ms', 'ceph.apply_latency_ms']:
            aggregator.assert_metric(metric, count=1, tags=expected_tags)
Exemple #7
0
def test_check(aggregator):
    ceph_check = Ceph(CHECK_NAME, {}, {})
    ceph_check.check(copy.deepcopy(BASIC_CONFIG))

    for metric in EXPECTED_METRICS:
        aggregator.assert_metric(metric, at_least=1)

    for sc in EXPECTED_SERVICE_CHECKS:
        aggregator.assert_service_check(sc, status=Ceph.OK, tags=EXPECTED_SERVICE_TAGS)
    aggregator.assert_service_check('ceph.overall_status', status=Ceph.OK, tags=EXPECTED_SERVICE_TAGS)
def test_osd_status_metrics_non_osd_health(_, aggregator):
    """
    The `detail` key of `health detail` can contain info on the health of non-osd units:
    shouldn't make the check fail
    """

    ceph_check = Ceph(CHECK_NAME, {}, {})
    ceph_check.check(copy.deepcopy(BASIC_CONFIG))

    aggregator.assert_metric('ceph.num_full_osds', value=0, count=1, tags=EXPECTED_TAGS)
    aggregator.assert_metric('ceph.num_near_full_osds', value=0, count=1, tags=EXPECTED_TAGS)
Exemple #9
0
def test_tagged_metrics(_, aggregator):

    ceph_check = Ceph(CHECK_NAME, {}, {})
    ceph_check.check(copy.deepcopy(BASIC_CONFIG))

    for osd in ['osd0', 'osd1', 'osd2']:
        expected_tags = EXPECTED_TAGS + ['ceph_osd:%s' % osd]

        for metric in ['ceph.commit_latency_ms', 'ceph.apply_latency_ms']:
            aggregator.assert_metric(metric, count=1, tags=expected_tags)

    for pool in ['pool0', 'rbd']:
        expected_tags = EXPECTED_TAGS + ['ceph_pool:%s' % pool]

        for metric in EXPECTED_METRICS_POOL_TAGS:
            aggregator.assert_metric(metric, count=1, tags=expected_tags)