Exporting Cloud Pak for Data metrics to Prometheus

Enable Cloud Pak for Data to export metrics to Prometheus so you can query Prometheus for metric data and view it in the OpenShift® Console.

Who needs to complete this task?
Cluster administrator A cluster administrator must perform this task.
How frequently should you perform this task?
One-time setup You should enable Cloud Pak for Data to export metrics to Prometheus only once after you install Cloud Pak for Data.

Before you begin

Ensure that you enable monitoring for user-defined projects and configure the OpenShift Monitoring stack. For more information about how to complete these tasks, see the documentation in the following table:

OpenShift Version Resources
Version 4.12
Version 4.14
Version 4.15
Version 4.16

About this task

After you create the service monitor in the following procedure, Cloud Pak for Data events are automatically sent to Prometheus. When Prometheus contains this metric data, you are able to run queries to retrieve the data and view it in the OpenShift Console.

Procedure

  1. Source the environment variables. For more information, see Sourcing the environment variables.
  2. From the PROJECT_CPD_INST_OPERANDS namespace, create the following custom resource:
    cat <<EOF |oc apply -f -
    apiVersion: monitoring.coreos.com/v1
    kind: ServiceMonitor
    metadata:
      name: zenmetrics
      namespace: ${PROJECT_CPD_INST_OPERANDS}
    spec:
      endpoints:
        - interval: 5m
          port: zenwatchdog-tls
          scheme: https
          tlsConfig:
            insecureSkipVerify: true
      selector:
        matchLabels:
          component: zen-watchdog
    EOF

Results

Now, all Cloud Pak for Data metrics are sent to Prometheus. Because the metric data is in Prometheus, you can run queries to view it in the OpenShift Console.

What to do next

To learn more about queries you can run from the OpenShift Console, see Running Prometheus queries from the OpenShift Console.