Skip to content

Commit 1c7cb30

Browse files
committed
add weaver stuff
1 parent 1b3a599 commit 1c7cb30

32 files changed

+2069
-347
lines changed

ibm-mq-metrics/Makefile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ WEAVER_CONTAINER_REPOSITORY=docker.io
33
# Versioned, non-qualified references to containers used in this Makefile.
44
# These are parsed from dependencies.Dockerfile so dependabot will autoupdate
55
# the versions of docker files we use.
6-
VERSIONED_WEAVER_CONTAINER_NO_REPO=$(shell cat buildscripts/dependencies.Dockerfile | awk '$$4=="weaver" {print $$2}')
6+
VERSIONED_WEAVER_CONTAINER_NO_REPO=$(shell cat weaver.Dockerfile | awk '$$4=="weaver" {print $$2}')
77
# Versioned, non-qualified references to containers used in this Makefile.
88
WEAVER_CONTAINER=$(WEAVER_CONTAINER_REPOSITORY)/$(VERSIONED_WEAVER_CONTAINER_NO_REPO)
99

@@ -55,12 +55,12 @@ check:
5555

5656
.PHONY: generate-java
5757
generate-java:
58-
mkdir -p src/main/java/com/splunk/ibm/mq/metrics
58+
mkdir -p src/main/java/io/opentelemetry/ibm/mq/metrics
5959
$(DOCKER_RUN) --rm \
6060
$(DOCKER_USER_IS_HOST_USER_ARG) \
6161
--mount 'type=bind,source=$(PWD)/model,target=/home/weaver/model,readonly' \
6262
--mount 'type=bind,source=$(PWD)/templates,target=/home/weaver/templates,readonly' \
63-
--mount 'type=bind,source=$(PWD)/src/main/java/com/splunk/ibm/mq/metrics,target=/home/weaver/target' \
63+
--mount 'type=bind,source=$(PWD)/src/main/java/io/opentelemetry/ibm/mq/metrics,target=/home/weaver/target' \
6464
${WEAVER_CONTAINER} registry generate \
6565
--registry=/home/weaver/model \
6666
java \

ibm-mq-metrics/README.md

Lines changed: 202 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,202 @@
1+
# IBM MQ Metrics
2+
3+
:warning: This software is under development.
4+
5+
## Use case
6+
7+
IBM MQ, formerly known as WebSphere MQ (message queue) series, is an IBM software for
8+
program-to-program messaging across multiple platforms.
9+
10+
The IBM MQ metrics utility here can monitor multiple queues managers and their resources,
11+
namely queues, topics, channels and listeners The metrics are extracted out using the
12+
[PCF command messages](https://www.ibm.com/support/knowledgecenter/en/SSFKSJ_8.0.0/com.ibm.mq.adm.doc/q020010_.htm).
13+
14+
The metrics for queue manager, queue, topic, channel and listener can be configured.
15+
16+
The MQ Monitor is compatible with IBM MQ version 7.x, 8.x and 9.x.
17+
18+
## Prerequisites
19+
20+
### Build
21+
22+
This software requires compilation with Java 11.
23+
It targets language level 8 and outputs java 8 class files.
24+
25+
The extension has a dependency on the following jar's depending on IBM MQ version:
26+
27+
* v8.0.0 and above
28+
```
29+
com.ibm.mq.allclient.jar
30+
```
31+
* For other versions
32+
```
33+
com.ibm.mq.commonservices.jar
34+
com.ibm.mq.jar
35+
com.ibm.mq.jmqi.jar
36+
com.ibm.mq.headers.jar
37+
com.ibm.mq.pcf.jar
38+
dhbcore.jar
39+
connector.jar
40+
```
41+
42+
These jar files are typically found in ```/opt/mqm/java/lib``` on a UNIX server but may be
43+
found in an alternate location depending upon your environment.
44+
45+
In case of **CLIENT** transport type, IBM MQ Client must be installed to get the MQ jars.
46+
To download IBM MQ Client jars, see [here](https://developer.ibm.com/messaging/mq-downloads/)
47+
48+
### MQ monitoring configuration
49+
50+
This software reads events from event queues associated with the queue manager:
51+
* `SYSTEM.ADMIN.PERFM.EVENT`: Performance events, such as low, high, and full queue depth events.
52+
* `SYSTEM.ADMIN.QMGR.EVENT`: Authority events
53+
* `SYSTEM.ADMIN.CONFIG.EVENT`: Configuration events
54+
55+
Please turn on those events to take advantage of this monitoring.
56+
57+
## Build
58+
59+
Build the package with:
60+
```shell
61+
./gradlew shadowJar
62+
```
63+
64+
Note: Due to restrictive licensing, this uber-jar (fat-jar) does not include the IBM client jar f
65+
66+
## Run
67+
68+
Run the standalone jar alongside the IBM jar:
69+
70+
```shell
71+
java \
72+
-Djavax.net.ssl.keyStore=key.jks \
73+
-Djavax.net.ssl.keyStorePassword=<password> \
74+
-Djavax.net.ssl.trustStore=key.jks \
75+
-Djavax.net.ssl.trustStorePassword=<password> \
76+
-cp target/ibm-mq-monitoring-<version>-all.jar:lib/com.ibm.mq.allclient.jar \
77+
io.opentelemetry.ibm.mq.opentelemetry.Main \
78+
./my-config.yml
79+
```
80+
81+
## Connection
82+
83+
There are two transport modes in which this extension can be run:
84+
* **Binding** : Requires WMQ Extension to be deployed in machine agent on the same machine where
85+
WMQ server is installed.
86+
* **Client** : In this mode, the WMQ extension is installed on a different host than the IBM MQ
87+
server. Please install the [IBM MQ Client](https://developer.ibm.com/messaging/mq-downloads/)
88+
for this mode to get the necessary jars as mentioned previously.
89+
90+
If this extension is configured for **CLIENT** transport type
91+
1. Please make sure the MQ's host and port is accessible.
92+
2. Credentials of user with correct access rights would be needed in config.yml
93+
[(Access Permissions section)](https://github.com/signalfx/opentelemetry-ibm-mq-monitoring-extension#access-permissions).
94+
3. If the hosting OS for IBM MQ is Windows, Windows user credentials will be needed.
95+
96+
If you are in **Bindings** mode, please make sure to start the MA process under a user which has
97+
the following permissions on the broker. Similarly, for **Client** mode, please provide the user
98+
credentials in config.yml which have permissions listed below.
99+
100+
The user connecting to the queueManager should have the inquire, get, put (since PCF responses
101+
cause dynamic queues to be created) permissions. For metrics that execute MQCMD_RESET_Q_STATS
102+
command, chg permission is needed.
103+
104+
### SSL Support
105+
106+
1. Configure the IBM SSL Cipher Suite in the config.yml.
107+
Note that, to use some CipherSuites the unrestricted policy needs to be configured in JRE.
108+
Please visit [this link](http://www.ibm.com/support/knowledgecenter/SSYKE2_8.0.0/com.ibm.java.security.component.80.doc/security-component/sdkpolicyfiles.html)
109+
for more details. For Oracle JRE, please update with [JCE Unlimited Strength Jurisdiction Policy](http://www.oracle.com/technetwork/java/javase/downloads/jce8-download-2133166.html).
110+
The download includes a readme file with instructions on how to apply these files to JRE
111+
112+
2. Please add the following JVM arguments to the MA start up command or script.
113+
114+
```-Dcom.ibm.mq.cfg.useIBMCipherMappings=false``` (If you are using IBM Cipher Suites, set the
115+
flag to true. Please visit [this link](http://www.ibm.com/support/knowledgecenter/SSFKSJ_8.0.0/com.ibm.mq.dev.doc/q113210_.htm) for more details.
116+
)
117+
3. To configure SSL, the MA's trust store and keystore needs to be setup with the JKS filepath.
118+
They can be passed either as Machine Agent JVM arguments or configured in config.yml (sslConnection) <br />
119+
120+
a. Machine Agent JVM arguments as follows:
121+
122+
```-Djavax.net.ssl.trustStore=<PATH_TO_JKS_FILE>```<br />
123+
```-Djavax.net.ssl.trustStorePassword=<PASS>```<br />
124+
```-Djavax.net.ssl.keyStore=<PATH_TO_JKS_FILE>```<br />
125+
```-Djavax.net.ssl.keyStorePassword=<PASS>```<br />
126+
127+
b. sslConnection in config.yml, configure the trustStorePassword. Same holds for keyStore configuration as well.
128+
129+
```
130+
sslConnection:
131+
trustStorePath: ""
132+
trustStorePassword: ""
133+
134+
keyStorePath: ""
135+
keyStorePassword: ""
136+
```
137+
138+
## Configuration
139+
140+
**Note** : Please make sure to not use tab (\t) while editing yaml files. You may want to validate
141+
the yaml file using a [yaml validator](https://jsonformatter.org/yaml-validator). Configure the monitor by copying and editing the
142+
config.yml file in <code>src/main/resources/config.yml</code>.
143+
144+
1. Configure the queueManagers with appropriate fields and filters. You can configure multiple
145+
queue managers in one configuration file.
146+
2. To run the extension at a frequency > 1 minute, please configure the taskSchedule section.
147+
Refer to the [Task Schedule](https://community.appdynamics.com/t5/Knowledge-Base/Task-Schedule-for-Extensions/ta-p/35414) doc for details.
148+
149+
### Monitoring Workings - Internals
150+
151+
This software extracts metrics through [PCF framework](https://www.ibm.com/support/knowledgecenter/SSFKSJ_8.0.0/com.ibm.mq.adm.doc/q019990_.htm). A complete list of PCF commands are
152+
listed [here](https://www.ibm.com/support/knowledgecenter/SSFKSJ_7.5.0/com.ibm.mq.ref.adm.doc/q086870_.htm). Each queue manager has an administration queue with a standard queue name and
153+
the extension sends PCF command messages to that queue. On Windows and Unix platforms, the PCF
154+
commands are sent is always sent to the SYSTEM.ADMIN.COMMAND.QUEUE queue. More details about that
155+
is mentioned [here](https://www.ibm.com/support/knowledgecenter/SSFKSJ_8.0.0/com.ibm.mq.adm.doc/q020010_.htm)
156+
157+
By default, the PCF responses are sent to the SYSTEM.DEFAULT.MODEL.QUEUE. Using this queue causes
158+
a temporary dynamic queue to be created. You can override the default here by using the
159+
`modelQueueName` and `replyQueuePrefix` fields in the config.yml.
160+
More details mentioned [here](https://www.ibm.com/support/knowledgecenter/SSFKSJ_7.5.0/com.ibm.mq.ref.adm.doc/q083240_.htm)
161+
162+
## Metrics
163+
164+
See [docs/metrics.md](docs/metrics.md).
165+
166+
## Troubleshooting
167+
1. Please follow the steps listed in this [troubleshooting-document](https://community.appdynamics.com/t5/Knowledge-Base/How-to-troubleshoot-missing-custom-metrics-or-extensions-metrics/ta-p/28695) in order to troubleshoot your issue. These are a set of common issues that customers might have faced during the installation of the extension.
168+
2. Error `Completion Code '2', Reason '2495'`
169+
Normally this error occurs if the environment variables are not set up correctly for this extension to work MQ in Bindings Mode.
170+
171+
If you are seeing `Failed to load the WebSphere MQ native JNI library: 'mqjbnd'`, please add the following jvm argument when starting the MA.
172+
173+
-Djava.library.path=\<path to libmqjbnd.so\> For eg. on Unix it could -Djava.library.path=/opt/mqm/java/lib64 for 64-bit or -Djava.library.path=/opt/mqm/java/lib for 32-bit OS
174+
175+
Sometimes you also have run the setmqenv script before using the above jvm argument to start the machine agent.
176+
177+
. /opt/mqm/bin/setmqenv -s
178+
179+
For more details, please check this [doc](https://www.ibm.com/support/knowledgecenter/en/SSFKSJ_7.1.0/com.ibm.mq.doc/zr00610_.htm)
180+
181+
This might occour due to various reasons ranging from incorrect installation to applying [ibm fix packs](http://www-01.ibm.com/support/docview.wss?uid=swg21410038) but most of the time it happens when you are trying to connect in `Bindings` mode and machine agent is not on the same machine on which WMQ server is running. If you want to connect to WMQ server from a remote machine then connect using `Client` mode.
182+
183+
Another way to get around this issue is to avoid using the Bindings mode. Connect using CLIENT transport type from a remote box.
184+
185+
3. Error `Completion Code '2', Reason '2035'`
186+
This could happen for various reasons but for most of the cases, for **Client** mode the user specified in config.yml is not authorized to access the queue manager. Also sometimes even if userid and password are correct, channel auth (CHLAUTH) for that queue manager blocks traffics from other ips, you need to contact admin to provide you access to the queue manager.
187+
For Bindings mode, please make sure that the MA is owned by a mqm user. Please check [this doc](https://www-01.ibm.com/support/docview.wss?uid=swg21636093)
188+
189+
4. `MQJE001: Completion Code '2', Reason '2195'`
190+
This could happen in **Client** mode. Please make sure that the IBM MQ dependency jars are correctly referenced in classpath of monitor.xml
191+
192+
5. `MQJE001: Completion Code '2', Reason '2400'`
193+
This could happen if unsupported cipherSuite is provided or JRE not having/enabled unlimited jurisdiction policy files. Please check SSL Support section.
194+
195+
6. If you are seeing "NoClassDefFoundError" or "ClassNotFound" error for any of the MQ dependency even after providing correct path in monitor.xml, then you can also try copying all the required jars in WMQMonitor (MAHome/monitors/WMQMonitor) folder and provide classpath in monitor.xml like below
196+
```
197+
<classpath>ibm-mq-monitoring-<version>-all.jar;com.ibm.mq.allclient.jar</classpath>
198+
```
199+
OR
200+
```
201+
<classpath>ibm-mq-monitoring-<version>-all.jar;com.ibm.mq.jar;com.ibm.mq.jmqi.jar;com.ibm.mq.commonservices.jar;com.ibm.mq.headers.jar;com.ibm.mq.pcf.jar;connector.jar;dhbcore.jar</classpath>
202+
```

0 commit comments

Comments
 (0)