|
| 1 | +# Monitoring metrics in Cloud Pak for Integration |
| 2 | +This directory contains sample files that show how to deploy the Prometheus |
| 3 | +monitor to expose queue metrics for a queue manager running in a Cloud Pak for |
| 4 | +Integration deployment on Red Hat OpenShift. |
| 5 | + |
| 6 | +The MQ Certified Container that comes in the Cloud Pak for Integration |
| 7 | +emits a range of [queue manager (server) scope metrics](https://www.ibm.com/docs/en/ibm-mq/9.2?topic=containers-metrics-published-by-mq-certified) but does not currently offer an option to |
| 8 | +publish information about queues or topics, so use of an additional Prometheus monitor pod as |
| 9 | +shown below allows queue (and topic) metrics to be published to Prometheus for consumption |
| 10 | +by OpenShift monitoring tools. |
| 11 | + |
| 12 | +The steps to do this are as follows; |
| 13 | + |
| 14 | +``` |
| 15 | +# Build the Prometheus monitor container as normal |
| 16 | +cd mq-metric-samples/scripts |
| 17 | +./buildRuntime.sh mq_prometheus |
| 18 | +
|
| 19 | +# Tag and push the Docker image to the container registry used by your OpenShift cluster |
| 20 | +docker tag mq-metric-prometheus:5.2.0 your.repo/your-namespace/mq-metric-prometheus:1.0 |
| 21 | +docker push your.repo/your-namespace/mq-metric-prometheus:1.0 |
| 22 | +
|
| 23 | +# Create a ConfigMap and Secret to configure the settings that you wish to apply to your monitor. |
| 24 | +# Update these to suit your requirements |
| 25 | +oc create configmap metrics-configuration \ |
| 26 | + --from-literal=IBMMQ_CONNECTION_QUEUEMANAGER='QM1' \ |
| 27 | + --from-literal=IBMMQ_CONNECTION_CONNNAME='quickstart-cp4i-ibm-mq(1414)' \ |
| 28 | + --from-literal=IBMMQ_CONNECTION_CHANNEL='SYSTEM.DEF.SVRCONN' \ |
| 29 | + --from-literal=IBMMQ_OBJECTS_QUEUES='*,!SYSTEM.*,!AMQ.*' \ |
| 30 | + --from-literal=IBMMQ_OBJECTS_SUBSCRIPTIONS='!$SYS*' \ |
| 31 | + --from-literal=IBMMQ_OBJECTS_TOPICS='!*' \ |
| 32 | + --from-literal=IBMMQ_GLOBAL_USEPUBLICATIONS=false \ |
| 33 | + --from-literal=IBMMQ_GLOBAL_USEOBJECTSTATUS=true \ |
| 34 | + --from-literal=IBMMQ_GLOBAL_CONFIGURATIONFILE='' \ |
| 35 | + --from-literal=IBMMQ_GLOBAL_LOGLEVEL=INFO |
| 36 | +
|
| 37 | +oc create secret generic metrics-credentials \ |
| 38 | + --from-literal=IBMMQ_CONNECTION_USER='dummyuser' \ |
| 39 | + --from-literal=IBMMQ_CONNECTION_PASSWORD='dummypassword' |
| 40 | +
|
| 41 | +
|
| 42 | +
|
| 43 | +# Use the samples in this directory to deploy the Prometheus container to OpenShift |
| 44 | +cd mq-metric-samples/cp4i |
| 45 | +
|
| 46 | +# Create a new ServiceAccount that will ensure the metrics pod is |
| 47 | +# deployed using the most secure Restricted SCC |
| 48 | +oc apply -f sa-pod-deployer.yaml |
| 49 | +
|
| 50 | +# Update the spec.containers.image attribute in metrics-pod.yaml to match |
| 51 | +# your container registry and image name using a text editor |
| 52 | +vi metrics-pod.yaml |
| 53 | +
|
| 54 | +# Deploy the metrics pod using the service account |
| 55 | +oc apply -f ./metrics-pod.yaml --as=my-service-account |
| 56 | +
|
| 57 | +# Create a Service object that exposes the metrics pod so that it can |
| 58 | +# be discovered by monitoring tools that are looking for Prometheus endpoints |
| 59 | +# |
| 60 | +# Note that the spec.selector.app matches the metadata.labels.app property |
| 61 | +# defined in metrics-pod.yaml |
| 62 | +oc apply -f ./metrics-service.yaml |
| 63 | +``` |
| 64 | + |
| 65 | + |
| 66 | +Once the metrics pod is deployed you can see it in action by looking at the logs |
| 67 | +for the pod, and the "IBMMQ Collect" statements showing that the metrics are being |
| 68 | +scraped by the Prometheus agent running in your OpenShift cluster. |
| 69 | +``` |
| 70 | +oc logs mq-metric-prometheus |
| 71 | +
|
| 72 | +
|
| 73 | +IBM MQ metrics exporter for Prometheus monitoring |
| 74 | +Build : 20210410-173628 |
| 75 | +Commit Level : 3dd2c0d |
| 76 | +Build Platform: Darwin/ |
| 77 | +
|
| 78 | +time="2021-04-13T20:12:52Z" level=info msg="Trying to connect as client using ConnName: quickstart-cp4i-ibm-mq(1414), Channel: SYSTEM.DEF.SVRCONN" |
| 79 | +time="2021-04-13T20:12:52Z" level=info msg="Connected to queue manager QM1" |
| 80 | +time="2021-04-13T20:12:52Z" level=info msg="IBMMQ Describe started" |
| 81 | +time="2021-04-13T20:12:52Z" level=info msg="Platform is UNIX" |
| 82 | +time="2021-04-13T20:12:52Z" level=info msg="Listening on http address :9157" |
| 83 | +time="2021-04-13T20:12:55Z" level=info msg="IBMMQ Collect started 14000001720300" |
| 84 | +time="2021-04-13T20:12:55Z" level=info msg="Collection time = 0 secs" |
| 85 | +time="2021-04-13T20:13:55Z" level=info msg="IBMMQ Collect started 14000003035700" |
| 86 | +time="2021-04-13T20:13:55Z" level=info msg="Collection time = 0 secs" |
| 87 | +``` |
0 commit comments