Configuring a Red Hat OpenShift monitoring service

Configure the Red Hat® OpenShift® monitoring service in the Red Hat OpenShift Container Platform console.

Procedure

  1. In the Red Hat OpenShift Container Platform console, click Workloads > ConfigMaps and select the configmap for your project, for example, cluster-monitoring-config.
  2. On the cluster-monitoring-config details page, select the YAML tab.
  3. Set the parameters for your configmap.
    1. If the enableUserWorkload parameter is false, set the parameter to true
    2. When the enableUserWorkload parameter is set to true, user-defined projects in a cluster are monitored.
  4. Increase the Prometheus retention policy, add a storage class, for example, ocs-storagecluster-cephfs, and specify the size.
    The default retention policy is 24 hours.
  5. Change the Alertmanager's ocs-storagecluster-cephfs storage class and size. For more information, see Alertmanager.
    To configure the core Red Hat OpenShift Container Platform monitoring components, you must create the cluster-monitoring-config configmap object in the openshift-monitoring project.
    The following text is an example of the cluster-monitoring-config.yml file for configuring cluster monitoring:
    kind: ConfigMap
    apiVersion: v1
    metadata:
      name: cluster-monitoring-config
      namespace: openshift-monitoring
    data:
      config.yaml: |
        enableUserWorkload: true
        prometheusK8s:
          retention: 90d
          volumeClaimTemplate:
            spec:
              storageClassName: ocs-storagecluster-cephfs
              resources:
                requests:
                  storage: 300Gi
        alertmanagerMain:
          volumeClaimTemplate:
            spec:
              storageClassName: ocs-storagecluster-cephfs
              resources:
                requests:
                  storage: 20Gi
  6. Create or update the user-workload-monitoring-config.yml file.
    To configure the components that monitor user-defined projects, you must create the user-workload-monitoring-config configmap object in the openshift-user-workload-monitoring project.
    apiVersion: v1
    kind: ConfigMap
    data:
      config.yaml: |
        prometheus:
          logLevel: info
          enforcedSampleLimit: 50000
          retention: 90d
          volumeClaimTemplate:
            spec:
              storageClassName: ocs-storagecluster-cephfs
              resources:
                requests:
                  storage: 300Gi
        alertmanagerMain:
          volumeClaimTemplate:
            spec:
              storageClassName: ocs-storagecluster-cephfs
              resources:
                requests:
                  storage: 20Gi
    metadata:
      name: user-workload-monitoring-config
      namespace: openshift-user-workload-monitoring
  7. Verify the status of the pods and run the following command:
    oc get pods -n openshift-user-workload-monitoring
  8. Check that the output matches the following sample:
    NAME                                                   READY   STATUS    RESTARTS   AGE
    prometheus-operator-576bf85cc6-jdrfm                   2/2     Running   0          15d
    prometheus-user-workload-0                             5/5     Running   1          15d
    prometheus-user-workload-1                             5/5     Running   1          15d
    thanos-ruler-user-workload-0                           3/3     Running   0          15d
    thanos-ruler-user-workload-1                           3/3     Running   0          15d
  9. Check the PVC status to determine whether the prometheus-user-workload pods are bound, or whether any issues exist in the bindings.