Configuring Prometheus Exporter to collect Apache Zookeeper metrics


Only perform the tasks in this topic if you have deployed BMC Helix IT Operations Managementon an OpenShift Cluster. 

OpenShift comes with a built-in instance of Prometheus by default. Zookeeper's self-monitoring utilizes Prometheus to gather metrics. To enable Zookeeper metric collection, configure it to send the metrics to BMC Helix Operations Management using the Scripting Knowledge Module.

When the collected metrics exceed the set thresholds, events are generated. You can see the metrics on BMC Helix Dashboards or in BMC Helix Operations Management and the events on either BMC Helix Operations Management or BMC Helix AIOps.

To enable user workload monitoring in OpenShift for Zookeeper

  1. To check whether cluster-monitoring-config ConfigMap exists, run the following command: 

    oc get cm cluster-monitoring-config -n openshift-monitoring -o yaml

    • If the ConfigMap exists and the workload monitoring is enabled, skip to step 2.
    • If the ConfigMap does not exist and the workload monitoring is not enabled, perform the following steps:


      1. Create the workload.yaml file and add the following content:

        apiVersion: v1
        kind: ConfigMap
        metadata:
             name: cluster-monitoring-config
            namespace: openshift-monitoring
        data:
            config.yaml: |
            enableUserWorkload: true
      2. Apply the changes by running the following command:

        oc create -f workload.yaml
  1. After a few minutes, to verify the workload is created, run the following command:

    oc -n openshift-user-workload-monitoring get pod

    Sample output:

    NAME                                   READY   STATUS        RESTARTS   AGE
    prometheus-operator-6f7b748d5b-t7nbg   2/2     Running       0          3h
    prometheus-user-workload-0             4/4     Running       1          3h
    prometheus-user-workload-1             4/4     Running       1          3h
    thanos-ruler-user-workload-0           3/3     Running       0          3h
    thanos-ruler-user-workload-1           3/3     Running       0          3h

To create a Prometheus ServiceMonitor for Apache Zookeeper

After creating the workload, perform the following steps to create a ServiceMonitor to scrape the Apache Zookeeper metrics:

  1. Create the zookeepersm.yaml file with the following content:

    apiVersion: monitoring.coreos.com/v1
    kind: ServiceMonitor
    metadata:
      labels:
        k8s-app: helix-zookeeper-monitor
        release: kube-prometheus-stack
      name: helix-zookeeper-monitor
     namespace: <BMC Helix ITOM namespace>
     spec:
      endpoints:
     - interval: 60s
        path: /metrics
        scrapeTimeout: 100s
        targetPort: 9141
      selector:
        matchLabels:
          app.kubernetes.io/name: zookeeper

  2. To create the ServiceMonitor, run the following command:

    oc create -f zookeepersm.yaml 
  3. To make sure the service monitor is created, run the following command:

    oc get servicemonitor -n <ITOM namespace>

    Sample output:

    NAME                      AGE
    helix-zookeeper-monitor   90d

 

Tip: For faster searching, add an asterisk to the end of your partial query. Example: cert*