-
Notifications
You must be signed in to change notification settings - Fork 159
Add ibm-mq-metrics #1960
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
breedx-splk
wants to merge
63
commits into
open-telemetry:main
Choose a base branch
from
breedx-splk:add_ibm_mq
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Add ibm-mq-metrics #1960
Changes from all commits
Commits
Show all changes
63 commits
Select commit
Hold shift + click to select a range
f0bfd46
first pass addition
breedx-splk 90e0f5f
cleanup and spotless
breedx-splk 6fa008c
continue cleanup
breedx-splk 1bf1993
continue cleanups
breedx-splk a2b95a8
more cleanups
breedx-splk 91080d3
more cleanups
breedx-splk cfd675c
fixing tests erroreprone
breedx-splk c0fde44
start adding/fixing integrationtests
breedx-splk 0f99f3f
fix integration test
breedx-splk 48a25aa
add component owners
breedx-splk d631ee8
add makefile
breedx-splk 17d0bd3
add weaver stuff
breedx-splk ffe34a1
add component
breedx-splk 8e0ae17
add to main readme
breedx-splk 4d99fde
spotless
breedx-splk 38a46f7
markdown fixes
breedx-splk c8edae6
markdown fixes
breedx-splk 16227e8
./gradlew spotlessApply
otelbot[bot] 33d8c3a
markdown fixes
breedx-splk c42c0cb
./gradlew spotlessApply
otelbot[bot] 2a72218
markdown fixes
breedx-splk 9247995
./gradlew spotlessApply
otelbot[bot] c353894
markdown fixes
breedx-splk 61dfb1d
generated classes fixes
breedx-splk b33e85a
./gradlew spotlessApply
otelbot[bot] f56faed
add missing files and nerf integration test until we can figure out d…
breedx-splk 319f2d9
remove terrible ibm.com links
breedx-splk 245793a
remove bad link
breedx-splk c9ba9a9
try and fix resource path on windows
breedx-splk a5942fe
Revert "try and fix resource path on windows"
breedx-splk 6f6e51e
rollback and try another approach at making windows happy
breedx-splk 2e7f41c
spotless
breedx-splk 3d73a46
more windows help
breedx-splk 97fee75
ugh
breedx-splk bc2ebb7
more windows
breedx-splk 7c6f9b1
cleanup
breedx-splk 45df268
update all metric names to have ibm prefix
breedx-splk 0ae4b47
update all metric ids to have ibm prefix
breedx-splk fd11244
use consistent quoting
breedx-splk 217d785
add ibm prefix
breedx-splk b7afbcb
fix usages to new names
breedx-splk bfbc35d
fix tests
breedx-splk 751c32b
begin fixing up attributes and generate weaver template for constants…
breedx-splk 2339571
wire up attribute key constants
breedx-splk edf5e8b
fix metric names
breedx-splk 6a6de13
additional attribute constants
breedx-splk 47ed258
make build command more specific
breedx-splk 8442cc3
remove typo
breedx-splk 2563d04
fix path to jar
breedx-splk 687dc12
note about java versions.
breedx-splk 9459d28
fix jar filename
breedx-splk 9743ad2
fix exception name
breedx-splk c8052e4
fix copypasta
breedx-splk 58654f7
java version comment
breedx-splk 3bf27da
fix units to singular
breedx-splk d39dcb8
fix units to bytes instead of mib
breedx-splk 8231127
remove word maven
breedx-splk fb8a19b
output logs to build dir
breedx-splk 987cabc
remove commented code
breedx-splk 675aa23
use Class.forName()
breedx-splk 9b26d3d
log4j is not used, remove configs.
breedx-splk df72aa4
log4j is not used, remove configs.
breedx-splk 496d650
remove shutdown hook and simplify meter
breedx-splk File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -90,3 +90,6 @@ components: | |
opamp-client: | ||
- LikeTheSalad | ||
- jackshirazi | ||
ibm-mq-metrics: | ||
- breedx-splk | ||
- atoulme |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
# From where to resolve the containers (e.g. "otel/weaver"). | ||
WEAVER_CONTAINER_REPOSITORY=docker.io | ||
# Versioned, non-qualified references to containers used in this Makefile. | ||
# These are parsed from dependencies.Dockerfile so dependabot will autoupdate | ||
# the versions of docker files we use. | ||
VERSIONED_WEAVER_CONTAINER_NO_REPO=$(shell cat weaver.Dockerfile | awk '$$4=="weaver" {print $$2}') | ||
# Versioned, non-qualified references to containers used in this Makefile. | ||
WEAVER_CONTAINER=$(WEAVER_CONTAINER_REPOSITORY)/$(VERSIONED_WEAVER_CONTAINER_NO_REPO) | ||
|
||
# Next - we want to run docker as our local file user, so generated code is not | ||
# owned by root, and we don't give unnecessary access. | ||
# | ||
# Determine if "docker" is actually podman | ||
DOCKER_VERSION_OUTPUT := $(shell docker --version 2>&1) | ||
DOCKER_IS_PODMAN := $(shell echo $(DOCKER_VERSION_OUTPUT) | grep -c podman) | ||
ifeq ($(DOCKER_IS_PODMAN),0) | ||
DOCKER_COMMAND := docker | ||
else | ||
DOCKER_COMMAND := podman | ||
endif | ||
DOCKER_RUN=$(DOCKER_COMMAND) run | ||
DOCKER_USER=$(shell id -u):$(shell id -g) | ||
DOCKER_USER_IS_HOST_USER_ARG=-u $(DOCKER_USER) | ||
ifeq ($(DOCKER_COMMAND),podman) | ||
# On podman, additional arguments are needed to make "-u" work | ||
# correctly with the host user ID and host group ID. | ||
# | ||
# Error: OCI runtime error: crun: setgroups: Invalid argument | ||
DOCKER_USER_IS_HOST_USER_ARG=--userns=keep-id -u $(DOCKER_USER) | ||
endif | ||
|
||
.PHONY: generate-docs | ||
generate-docs: | ||
mkdir -p docs | ||
$(DOCKER_RUN) --rm \ | ||
$(DOCKER_USER_IS_HOST_USER_ARG) \ | ||
--mount 'type=bind,source=$(PWD)/model,target=/home/weaver/model,readonly' \ | ||
--mount 'type=bind,source=$(PWD)/templates,target=/home/weaver/templates,readonly' \ | ||
--mount 'type=bind,source=$(PWD)/docs,target=/home/weaver/target' \ | ||
${WEAVER_CONTAINER} registry generate \ | ||
--registry=/home/weaver/model \ | ||
markdown \ | ||
--future \ | ||
/home/weaver/target | ||
|
||
.PHONY: check | ||
check: | ||
$(DOCKER_RUN) --rm \ | ||
$(DOCKER_USER_IS_HOST_USER_ARG) \ | ||
--mount 'type=bind,source=$(PWD)/model,target=/home/weaver/model,readonly' \ | ||
--mount 'type=bind,source=$(PWD)/templates,target=/home/weaver/templates,readonly' \ | ||
--mount 'type=bind,source=$(PWD)/docs,target=/home/weaver/target' \ | ||
${WEAVER_CONTAINER} registry check \ | ||
--registry=/home/weaver/model | ||
|
||
.PHONY: generate-java | ||
generate-java: | ||
mkdir -p src/main/java/io/opentelemetry/ibm/mq/metrics | ||
$(DOCKER_RUN) --rm \ | ||
$(DOCKER_USER_IS_HOST_USER_ARG) \ | ||
--mount 'type=bind,source=$(PWD)/model,target=/home/weaver/model,readonly' \ | ||
--mount 'type=bind,source=$(PWD)/templates,target=/home/weaver/templates,readonly' \ | ||
--mount 'type=bind,source=$(PWD)/src/main/java/io/opentelemetry/ibm/mq/metrics,target=/home/weaver/target' \ | ||
${WEAVER_CONTAINER} registry generate \ | ||
--registry=/home/weaver/model \ | ||
java \ | ||
--future \ | ||
/home/weaver/target | ||
|
||
.PHONY: generate-yaml | ||
generate-yaml: | ||
$(DOCKER_RUN) --rm \ | ||
$(DOCKER_USER_IS_HOST_USER_ARG) \ | ||
--mount 'type=bind,source=$(PWD)/model,target=/home/weaver/model,readonly' \ | ||
--mount 'type=bind,source=$(PWD)/templates,target=/home/weaver/templates,readonly' \ | ||
--mount 'type=bind,source=$(PWD)/,target=/home/weaver/target' \ | ||
${WEAVER_CONTAINER} registry generate \ | ||
--registry=/home/weaver/model \ | ||
yaml \ | ||
--future \ | ||
/home/weaver/target | ||
|
||
.PHONY: generate | ||
generate: generate-docs generate-yaml generate-java |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,228 @@ | ||
# IBM MQ Metrics | ||
|
||
:warning: This software is under development. | ||
|
||
## Use case | ||
|
||
IBM MQ, formerly known as WebSphere MQ (message queue) series, is an IBM software for | ||
program-to-program messaging across multiple platforms. | ||
|
||
The IBM MQ metrics utility here can monitor multiple queues managers and their resources, | ||
namely queues, topics, channels and listeners The metrics are extracted out using the | ||
[PCF command messages](https://www.ibm.com/support/knowledgecenter/en/SSFKSJ_8.0.0/com.ibm.mq.adm.doc/q020010_.htm). | ||
|
||
The metrics for queue manager, queue, topic, channel and listener can be configured. | ||
|
||
The MQ Monitor is compatible with IBM MQ version 7.x, 8.x and 9.x. | ||
|
||
## Prerequisites | ||
|
||
This software requires compilation with Java 11. | ||
It targets language level 8 and outputs java 8 class files. | ||
|
||
The extension has a dependency on the following jar's depending on IBM MQ version: | ||
|
||
* v8.0.0 and above | ||
|
||
``` | ||
com.ibm.mq.allclient.jar | ||
``` | ||
|
||
* For other versions | ||
|
||
``` | ||
com.ibm.mq.commonservices.jar | ||
com.ibm.mq.jar | ||
com.ibm.mq.jmqi.jar | ||
com.ibm.mq.headers.jar | ||
com.ibm.mq.pcf.jar | ||
dhbcore.jar | ||
connector.jar | ||
``` | ||
|
||
These jar files are typically found in ```/opt/mqm/java/lib``` on a UNIX server but may be | ||
found in an alternate location depending upon your environment. | ||
|
||
In case of **CLIENT** transport type, IBM MQ Client must be installed to get the MQ jars. | ||
[The IBM MQ Client jars can be downloaded here](https://developer.ibm.com/messaging/mq-downloads/). | ||
|
||
### MQ monitoring configuration | ||
|
||
This software reads events from event queues associated with the queue manager: | ||
|
||
* `SYSTEM.ADMIN.PERFM.EVENT`: Performance events, such as low, high, and full queue depth events. | ||
* `SYSTEM.ADMIN.QMGR.EVENT`: Authority events | ||
* `SYSTEM.ADMIN.CONFIG.EVENT`: Configuration events | ||
|
||
Please turn on those events to take advantage of this monitoring. | ||
|
||
## Build | ||
|
||
Build the package with: | ||
|
||
```shell | ||
cd ibm-mq-metrics | ||
../gradlew shadowJar | ||
``` | ||
|
||
Note: Due to restrictive licensing, this uber-jar (fat-jar) does not include the IBM client jar. | ||
|
||
## Run | ||
|
||
Run the standalone jar alongside the IBM jar: | ||
|
||
```shell | ||
cd ibm-mq-metrics | ||
java \ | ||
-Djavax.net.ssl.keyStore=key.jks \ | ||
-Djavax.net.ssl.keyStorePassword=<password> \ | ||
-Djavax.net.ssl.trustStore=key.jks \ | ||
-Djavax.net.ssl.trustStorePassword=<password> \ | ||
-cp build/libs/opentelemetry-ibm-mq-monitoring-<version>-all.jar:lib/com.ibm.mq.allclient.jar \ | ||
io.opentelemetry.ibm.mq.opentelemetry.Main \ | ||
./my-config.yml | ||
``` | ||
|
||
## Connection | ||
|
||
There are two transport modes in which this extension can be run: | ||
|
||
* **Binding** : Requires WMQ Extension to be deployed in machine agent on the same machine where | ||
WMQ server is installed. | ||
* **Client** : In this mode, the WMQ extension is installed on a different host than the IBM MQ | ||
server. Please install the [IBM MQ Client](https://developer.ibm.com/messaging/mq-downloads/) | ||
for this mode to get the necessary jars as mentioned previously. | ||
|
||
If this extension is configured for **CLIENT** transport type | ||
|
||
1. Please make sure the MQ's host and port is accessible. | ||
2. Credentials of user with correct access rights would be needed in config.yml. | ||
3. If the hosting OS for IBM MQ is Windows, Windows user credentials will be needed. | ||
|
||
If you are in **Bindings** mode, please make sure to start the MA process under a user which has | ||
the following permissions on the broker. Similarly, for **Client** mode, please provide the user | ||
credentials in config.yml which have permissions listed below. | ||
|
||
The user connecting to the queueManager should have the inquire, get, put (since PCF responses | ||
cause dynamic queues to be created) permissions. For metrics that execute MQCMD_RESET_Q_STATS | ||
command, chg permission is needed. | ||
|
||
### SSL Support | ||
|
||
_Note: The following is only needed for versions of Java 8 before 8u161._ | ||
|
||
1. Configure the IBM SSL Cipher Suite in the config.yml. | ||
Note that, to use some CipherSuites the unrestricted policy needs to be configured in JRE. | ||
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) | ||
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). | ||
The download includes a readme file with instructions on how to apply these files to JRE. | ||
|
||
2. Please add the following JVM arguments to the MA start up command or script. | ||
|
||
```-Dcom.ibm.mq.cfg.useIBMCipherMappings=false``` (If you are using IBM Cipher Suites, set the | ||
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. | ||
) | ||
3. To configure SSL, the MA's trust store and keystore needs to be setup with the JKS filepath. | ||
They can be passed either as Machine Agent JVM arguments or configured in config.yml (sslConnection) <br /> | ||
|
||
a. Machine Agent JVM arguments as follows: | ||
|
||
```-Djavax.net.ssl.trustStore=<PATH_TO_JKS_FILE>```<br /> | ||
```-Djavax.net.ssl.trustStorePassword=<PASS>```<br /> | ||
```-Djavax.net.ssl.keyStore=<PATH_TO_JKS_FILE>```<br /> | ||
```-Djavax.net.ssl.keyStorePassword=<PASS>```<br /> | ||
|
||
b. sslConnection in config.yml, configure the trustStorePassword. Same holds for keyStore configuration as well. | ||
|
||
``` | ||
sslConnection: | ||
trustStorePath: "" | ||
trustStorePassword: "" | ||
|
||
keyStorePath: "" | ||
keyStorePassword: "" | ||
``` | ||
|
||
## Configuration | ||
|
||
**Note** : Please make sure to not use tab (\t) while editing yaml files. You may want to validate | ||
the yaml file using a [yaml validator](https://jsonformatter.org/yaml-validator). Configure the monitor by copying and editing the | ||
config.yml file in <code>src/main/resources/config.yml</code>. | ||
|
||
1. Configure the queueManagers with appropriate fields and filters. You can configure multiple | ||
queue managers in one configuration file. | ||
2. To run the extension at a frequency > 1 minute, please configure the taskSchedule section. | ||
Refer to the [Task Schedule](https://community.appdynamics.com/t5/Knowledge-Base/Task-Schedule-for-Extensions/ta-p/35414) doc for details. | ||
|
||
### Monitoring Workings - Internals | ||
|
||
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 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 | ||
the extension sends PCF command messages to that queue. On Windows and Unix platforms, the PCF | ||
commands are sent is always sent to the SYSTEM.ADMIN.COMMAND.QUEUE queue. | ||
[More details mentioned here](https://www.ibm.com/support/knowledgecenter/SSFKSJ_8.0.0/com.ibm.mq.adm.doc/q020010_.htm) | ||
|
||
By default, the PCF responses are sent to the SYSTEM.DEFAULT.MODEL.QUEUE. Using this queue causes | ||
a temporary dynamic queue to be created. You can override the default here by using the | ||
`modelQueueName` and `replyQueuePrefix` fields in the config.yml. | ||
[More details mentioned here](https://www.ibm.com/support/knowledgecenter/SSFKSJ_7.5.0/com.ibm.mq.ref.adm.doc/q083240_.htm) | ||
|
||
## Metrics | ||
|
||
See [docs/metrics.md](docs/metrics.md). | ||
|
||
## Troubleshooting | ||
|
||
1. Error `Completion Code '2', Reason '2495'` | ||
Normally this error occurs if the environment variables are not set up correctly for this extension to work MQ in Bindings Mode. | ||
|
||
If you are seeing `Failed to load the WebSphere MQ native JNI library: 'mqjbnd'`, please add the following jvm argument when starting the MA. | ||
|
||
-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 | ||
|
||
Sometimes you also have run the setmqenv script before using the above jvm argument to start the machine agent. | ||
|
||
. /opt/mqm/bin/setmqenv -s | ||
|
||
For more details, please check this [doc](https://www.ibm.com/support/knowledgecenter/en/SSFKSJ_7.1.0/com.ibm.mq.doc/zr00610_.htm) | ||
|
||
This might occur due to various reasons ranging from incorrect installation to applying | ||
IBM Fix Packs, 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. | ||
|
||
Another way to get around this issue is to avoid using the Bindings mode. Connect using CLIENT | ||
transport type from a remote box. | ||
|
||
2. Error `Completion Code '2', Reason '2035'` | ||
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. | ||
For Bindings mode, please make sure that the MA is owned by a mqm user. | ||
|
||
3. `MQJE001: Completion Code '2', Reason '2195'` | ||
This could happen in **Client** mode. Please make sure that the IBM MQ dependency jars are correctly referenced in classpath of monitor.xml | ||
|
||
4. `MQJE001: Completion Code '2', Reason '2400'` | ||
This could happen if unsupported cipherSuite is provided or JRE not having/enabled unlimited jurisdiction policy files. Please check SSL Support section. | ||
|
||
5. If you are seeing `NoClassDefFoundError` or `ClassNotFoundException` 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 | ||
|
||
``` | ||
<classpath>opentelemetry-ibm-mq-monitoring-<version>-all.jar;com.ibm.mq.allclient.jar</classpath> | ||
``` | ||
|
||
OR | ||
|
||
``` | ||
<classpath>opentelemetry-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> | ||
``` | ||
|
||
## Component Owners | ||
|
||
- [Antoine Toulme Sharma](https://github.com/atoulme), Splunk | ||
- [Jason Plumb](https://github.com/breedx-splk), Splunk | ||
|
||
Learn more about component owners in [component_owners.yml](../.github/component_owners.yml). |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it would be a good idea to mention that this is not needed on oracle 9 and later and also in 8 since u161 https://www.oracle.com/java/technologies/javase/8u161-relnotes.html#JDK-8170157
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems then like it would be safe to say just "java 8 below 8u161" then right?