Configuring Prometheus Exporter to collect Apache Zookeeper metrics
To enable user workload monitoring in OpenShift for Zookeeper
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:
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: trueApply the changes by running the following command:
oc create -f workload.yaml
After a few minutes, to verify the workload is created, run the following command:
oc -n openshift-user-workload-monitoring get podSample 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:
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: zookeeperTo create the ServiceMonitor, run the following command:
oc create -f zookeepersm.yamlTo 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
Where to go from here
Tip: For faster searching, add an asterisk to the end of your partial query. Example: cert*