def test_ceph_metrics_presence_when_osd_down(measure_stop_ceph_osd):
    """
    Since ODF 4.9 ceph metrics covering disruptions will be available only
    when there are some disruptions to report, as noted in BZ 2028649.

    This test case covers this behaviour for one stopped/disabled OSD.
    """
    prometheus = PrometheusAPI()
    metrics_expected = list(metrics.ceph_metrics_healthy)
    # metrics which should be present with one OSD down
    for mtr in ("ceph_pg_degraded", "ceph_pg_undersized"):
        assert mtr in metrics.ceph_metrics, "test code needs to be updated"
        # make sure the test code is consistent with metrics module
        metrics_expected.append(mtr)
    # metrics which should not be present with one OSD down
    for mtr in ["ceph_pg_clean"]:
        assert mtr in metrics.ceph_metrics, "test code needs to be updated"
        metrics_expected.remove(mtr)
    metrics_without_results = metrics.get_missing_metrics(
        prometheus,
        metrics_expected,
        current_platform=config.ENV_DATA["platform"].lower(),
        start=measure_stop_ceph_osd["start"],
        stop=measure_stop_ceph_osd["stop"],
    )
    msg = ("Prometheus should provide some value(s) for all tested metrics, "
           "so that the list of metrics without results is empty.")
    assert metrics_without_results == [], msg
Exemplo n.º 2
0
def test_ceph_rgw_metrics_after_metrics_exporter_respin(rgw_deployments):
    """
    RGW metrics should be provided via OCP Prometheus even after
    ocs-metrics-exporter pod is respinned.

    """
    logger.info("Respin ocs-metrics-exporter pod")
    pod_obj = ocp.OCP(kind=constants.POD,
                      namespace=defaults.ROOK_CLUSTER_NAMESPACE)
    metrics_pods = pod_obj.get(
        selector="app.kubernetes.io/name=ocs-metrics-exporter")["items"]
    assert len(metrics_pods) == 1
    metrics_pod_data = metrics_pods[0]
    metrics_pod = OCS(**metrics_pod_data)
    metrics_pod.delete(force=True)

    logger.info("Wait for ocs-metrics-exporter pod to come up")
    assert pod_obj.wait_for_resource(
        condition="Running",
        selector="app.kubernetes.io/name=ocs-metrics-exporter",
        resource_count=1,
        timeout=600,
    )

    logger.info("Collect RGW metrics")
    prometheus = PrometheusAPI()
    list_of_metrics_without_results = metrics.get_missing_metrics(
        prometheus, metrics.ceph_rgw_metrics)
    msg = (
        "OCS Monitoring should provide some value(s) for tested rgw metrics, "
        "so that the list of metrics without results is empty.")
    assert list_of_metrics_without_results == [], msg
def test_ceph_rbd_metrics_available():
    """
    Ceph RBD metrics should be provided via OCP Prometheus as well.
    See also: https://ceph.com/rbd/new-in-nautilus-rbd-performance-monitoring/
    """
    prometheus = PrometheusAPI()
    list_of_metrics_without_results = metrics.get_missing_metrics(
        prometheus, metrics.ceph_rbd_metrics)
    msg = (
        "OCS Monitoring should provide some value(s) for tested rbd metrics, "
        "so that the list of metrics without results is empty.")
    assert list_of_metrics_without_results == [], msg
Exemplo n.º 4
0
def check_ceph_metrics_available():
    """
    Check ceph metrics available

    Returns:
        bool: True on success, false otherwise

    """
    logger.info('check ceph metrics available')
    # Check ceph metrics available
    prometheus = ocs_ci.utility.prometheus.PrometheusAPI()
    list_of_metrics_without_results = metrics.get_missing_metrics(
        prometheus,
        metrics.ceph_metrics,
        current_platform=config.ENV_DATA['platform'].lower())
    return list_of_metrics_without_results == []
Exemplo n.º 5
0
def check_ceph_metrics_available():
    """
    Check that all healthy ceph metrics are available.

    Returns:
        bool: True on success, false otherwise

    """
    logger.info("check ceph metrics available")
    # Check ceph metrics available
    prometheus = ocs_ci.utility.prometheus.PrometheusAPI()
    list_of_metrics_without_results = metrics.get_missing_metrics(
        prometheus,
        metrics.ceph_metrics_healthy,
        current_platform=config.ENV_DATA["platform"].lower(),
    )
    return list_of_metrics_without_results == []
Exemplo n.º 6
0
def test_ceph_metrics_available():
    """
    Ceph metrics as listed in KNIP-634 should be provided via OCP Prometheus.

    Ceph Object Gateway https://docs.ceph.com/docs/master/radosgw/ is
    deployed on on-prem platforms only (such as VMWare - see BZ 1763150),
    so this test case ignores failures for ceph_rgw_* and ceph_objecter_*
    metrics when running on cloud platforms (such as AWS).
    """
    prometheus = PrometheusAPI()
    list_of_metrics_without_results = metrics.get_missing_metrics(
        prometheus,
        metrics.ceph_metrics,
        current_platform=config.ENV_DATA['platform'].lower())
    msg = (
        "OCS Monitoring should provide some value(s) for all tested metrics, "
        "so that the list of metrics without results is empty.")
    assert list_of_metrics_without_results == [], msg