Skip to content

Commit 322e8f6

Browse files
committed
Update to MQ 9.3.1
1 parent 145c553 commit 322e8f6

39 files changed

+416
-211
lines changed

CHANGELOG.md

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
11
# Changelog
22
Newest updates are at the top of this file.
33

4-
### xxx xx 2022
5-
* Add sample showing TLS configuration in container
6-
* Update vendored dependencies
4+
### Oct 18 2022 (v5.3.2)
5+
* Update to MQ 9.3.1
6+
* Update to use v5.3.2 of mq-golang repository
7+
* Update all vendored dependencies
8+
* Add sample script showing TLS configuration in container
79
* Update Prometheus channel status sample dashboard to show channel instance counts
810
* Add AMQP channel status reporting to all collectors
9-
* Add single CLUSTER tag to queues (#191)
11+
* Add single CLUSTER tag to queues (ibm-messaging/mq-golang#191)
1012

1113
### Jul 07 2022 (v5.3.1)
1214
* Update to use v5.3.1 of mq-golang repository

Dockerfile.build

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ RUN mkdir -p $GOPATH/src $GOPATH/bin $GOPATH/pkg \
5959
# Location of the downloadable MQ client package \
6060
ENV RDURL="https://public.dhe.ibm.com/ibmdl/export/pub/software/websphere/messaging/mqdev/redist" \
6161
RDTAR="IBM-MQC-Redist-LinuxX64.tar.gz" \
62-
VRMF=9.3.0.0
62+
VRMF=9.3.1.0
6363

6464
# Install the MQ client from the Redistributable package. This also contains the
6565
# header files we need to compile against. Setup the subset of the package

Dockerfile.run

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ RUN apt-get update \
3131
# Location of the downloadable MQ client package \
3232
ENV RDURL="https://public.dhe.ibm.com/ibmdl/export/pub/software/websphere/messaging/mqdev/redist" \
3333
RDTAR="IBM-MQC-Redist-LinuxX64.tar.gz" \
34-
VRMF=9.3.0.0
34+
VRMF=9.3.1.0
3535

3636
# Install the MQ client from the Redistributable package. This also contains the
3737
# header files we need to compile against. Setup the subset of the package

README.md

Lines changed: 44 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# mq-metric-samples
22

3-
This repository contains a collection of IBM® MQ monitoring agents that utilize
4-
the [IBM® MQ golang metric packages](https://github.com/ibm-messaging/mq-golang)
3+
This repository contains a collection of IBM MQ monitoring agents that utilize
4+
the [IBM MQ golang metric packages](https://github.com/ibm-messaging/mq-golang)
55
to provide programs that can be used with existing monitoring technologies
66
such as Prometheus, AWS CloudWatch, etc. Statistics and status information
77
can be collected from queue managers and made available in databases to enable
@@ -19,7 +19,7 @@ This package is provided as-is with no guarantees of support or updates.
1919
There are also no guarantees of compatibility with any future versions of the package;
2020
interfaces and functions are subject to change based on any feedback.
2121

22-
These programs use a specific version of the `mqmetric` and `ibmmq` golang packages.pu
22+
These programs use a specific version of the `mqmetric` and `ibmmq` golang packages.
2323
Those packages are in the [mq-golang repository](https://github.com/ibm-messaging/mq-golang)
2424
and are also included in the `vendor` tree of this repository. They are referenced in the `go.mod`
2525
file if you wish to reload all of the dependencies by running `go mod vendor`.
@@ -30,50 +30,53 @@ file if you wish to reload all of the dependencies by running `go mod vendor`.
3030

3131
You will require the following programs:
3232

33-
* Go compiler. Building the InfluxDB collector requires Go 17 as the minimum compiler level. If you don't want
34-
to build that particular collector then older levels can be used.
33+
* Go compiler - version 1.17 is the minimum defined here
34+
* C compiler
3535

36-
To build the programs on Linux and MacOS, you may set an environment variable to permit some compile/link flags.
37-
This is due to security controls in the compiler.
3836

39-
```
40-
export CGO_LDFLAGS_ALLOW="-Wl,-rpath.*"
41-
```
37+
### MQ Client SDK
38+
The MQ Client SDK for C programs is required in order to compile and run Go programs. You may have this from an MQ Client installation image (eg rpm, dep formats for Linux, msi for Windows).
39+
40+
For Linux x64 and Windows systems, you may also choose to use the
41+
MQ Redistributable Client package which is a simple zip/tar file that does not need
42+
any privileges to install:
43+
44+
* Download [IBM MQ redistributable client](https://public.dhe.ibm.com/ibmdl/export/pub/software/websphere/messaging/mqdev/redist)
45+
* Unpack archive to fixed directory. E.g. `c:\IBM-MQC-Redist-Win64` or `/opt/mqm`.
46+
47+
See the README file in the mq-golang repository for more information about any environment variables that may
48+
be required to point at non-default directories for the MQ C SDK.
4249

4350
### Building a component
4451

4552
* You need to have the MQ client libraries installed first.
46-
* Set up an environment for compiling Go programs
47-
```
48-
export GOPATH=~/go (or wherever you want to put it)
49-
export GOROOT=/usr/lib/golang (or wherever you have installed it)
50-
mkdir -p $GOPATH/src
51-
cd $GOPATH/src
52-
```
53-
54-
* Change directory to your go path. (`cd $GOPATH`). Although GOPATH is no longer needed in the module world,
55-
it's still a convenient variable when cloning and building the programs.
56-
* Use git to get a copy of this repository into a new directory in the workspace:
53+
* Create a directory where you want to work with the programs.
54+
* Change to that directory.
55+
* Use git to get a copy of this repository into a new directory in the workspace. For example:
5756

5857
```
5958
git clone https://github.com/ibm-messaging/mq-metric-samples.git src/github.com/ibm-messaging/mq-metric-samples
6059
```
6160

62-
* Navigate to the mq-metric-samples root directory (`$GOPATH/src/github.com/ibm-messaging/mq-metric-samples`)
61+
* Navigate to the mq-metric-samples root directory (`./src/github.com/ibm-messaging/mq-metric-samples`)
6362
* All the prereq packages are already available in the vendor directory, but you can run `go mod vendor` to reload them
6463

6564
* From this root directory of the repository you can then compile the code. For example,
6665

6766
```
68-
cd $GOPATH/src/github.com/ibm-messaging/mq-metric-samples
67+
cd ./src/github.com/ibm-messaging/mq-metric-samples
6968
export CGO_LDFLAGS_ALLOW='-Wl,-rpath.*'
70-
go build -o $GOPATH/bin/mq_prometheus ./cmd/mq_prometheus/*.go
69+
mkdir -p /tmp/go/bin
70+
go build -mod=vendor -o /tmp/go/bin/mq_prometheus ./cmd/mq_prometheus/*.go
7171
```
7272

73-
At this point, you should have a compiled copy of the code in `$GOPATH/bin`. Each
73+
At this point, you should have a compiled copy of the code in `/tmp/go/bin`. Each
7474
monitor agent directory also has sample scripts, configuration files etc to help
7575
with getting the agent running in your specific environment.
7676

77+
The `-mod=vendor` option is important so that the build process does not need to
78+
download additional files from external repositories.
79+
7780
## Using a Docker container to build the programs
7881
You can use the `buildMonitors.sh` script in the `scripts` subdirectory to build a Docker container that
7982
in turn will build all the binary programs and copy them to a local directory. That script also
@@ -97,10 +100,10 @@ monitor must have a MAXDEPTH suitable for the expected amount of data. For publi
97100
estimated based on holding one minute's amount of publications; the number of monitored channels is also
98101
used as an estimate, although that does not need to be time-based as the data is requested directly by the
99102
monitor.
100-
* USEDLQ on the admin topic: The USEDLQ attribute on the topic object associated with the metrics publications (usually
101-
SYSTEM.ADMIN.TOPIC) determines what happens if the subscriber's queue is full. You might prefer to set this to
102-
NO to avoid filling the system DLQ if the collection program does not read the publications frequently enough.
103+
* USEDLQ on the admin topic: The USEDLQ attribute on the topic object associated with the metrics publications (usually `SYSTEM.ADMIN.TOPIC`) determines what happens if the subscriber's queue is full. You might prefer to set this to NO to avoid filling the system DLQ if the collection program does not read the publications frequently enough.
103104

105+
### Local and client connections
106+
Connections to the queue manager can be made with either local or client bindings. Running the collector "alongside" the queue manager is usually preferred, with the collector configured to run as a service. Sample scripts in this repository show how to define an appropriate MQ SERVICE. Client connections can be made by specifying the channel and connName information in the basic configuration; in this mode, only plaintext communication is available (similar to the MQSERVER environment variable). For secure communication using TLS, then you must provide connection information via a CCDT. Use the `ccdtUrl` configuration option or environment variables to point at a CCDT that can be in either binary or JSON format. The `runMonitorTLS.sh` script gives a simple example of setting up a container to use TLS.
104107

105108
### Using durable subscriptions
106109
An alternative collection mechanism uses durable subscriptions for the queue metric data. This may avoid needing to increase
@@ -131,7 +134,7 @@ via flags, via environment variables, or in a YAML file described below.
131134
### Wildcard Patterns for Queues
132135
The sets of queues to be monitored can be given either directly on the command line with the
133136
`-ibmmq.monitoredQueues` flag, put into a separate file which is also
134-
named on the command line, with the `-ibmmq.monitoredQueuesFile` flag, or in the YAML configuration.
137+
named on the command line, with the `-ibmmq.monitoredQueuesFile` flag, or in the equivalent YAML configuration.
135138

136139
The parameter can include both positive and negative
137140
wildcards. For example `ibmmq.monitoredQueues=A*,!AB*"` will collect data on
@@ -151,8 +154,7 @@ The channels to be monitored are set on the command line, similarly to
151154
the queue patterns, with `-ibmmq.monitoredChannels` or `-ibmmq.monitoredChannelFile`.
152155
Unlike the queue monitoring, wildcards are handled automatically by the channel
153156
status API. So you do not need to restart this monitor in order to pick up newly-defined
154-
channels that match an existing pattern. Only positive wildcards are allowed here; you cannot
155-
explicitly exclude channels.
157+
channels that match an existing pattern. Only positive wildcards are allowed here; you cannot explicitly exclude channels.
156158

157159
Another parameter is `pollInterval`. This determines how frequently the
158160
channel status is collected. You may want to have it collected at a different rate to
@@ -166,7 +168,7 @@ A short-lived channel that connects and then disconnects in between collection i
166168
will leave no trace in the status or metrics.
167169

168170
#### Channel Metrics
169-
A few of the responses from the DISPLAY CHSTATUS command have been selected
171+
Some the responses from the DISPLAY CHSTATUS command have been selected
170172
as metrics. The key values returned include the status and number of messages processed.
171173

172174
The message count for SVRCONN channels is the number of MQI calls made by the client program.
@@ -203,18 +205,16 @@ To also see the inactive channels, then set the showInactiveChannels
203205
configuration attribute to true.
204206

205207
### z/OS Support
206-
Because the DIS QSTATUS and DIS CHSTATUS commands can be used on z/OS, the monitors can now
207-
support showing some limited information from a z/OS queue manager. There is nothing special needed to configure it, beyond the client
208+
Because the DIS QSTATUS and DIS CHSTATUS commands can be used on z/OS, the monitors
209+
support showing some information from a z/OS queue manager. There is nothing special needed to configure it, beyond the client
208210
connectivity that allows an application to connect to the z/OS system.
209211

210212
The `-ibmmq.useStatus` (command line) or `useObjectStatus` (YAML) parameter must be set to `true` to use the DIS QSTATUS command.
211213

212214
There is also support for using the RESET QSTATS command on z/OS. This needs to be explicitly enabled
213215
by setting the `-ibmmq.resetQStats` (command line) or `useResetQStats` (YAML) flag to true. While this option allows tracking of the number
214-
of messages put/got to a queue (which is otherwise unavailable from z/OS queue manager status queries), it
215-
should not be used if there are any other active monitoring solutions that are already using that command.
216-
Only one monitor program can reliably use RESET QSTATS on a particular queue manager, to avoid the information
217-
being split between them.
216+
of messages put/got to a queue (which is otherwise unavailable from z/OS queue manager status queries), it should not be used if there are any other active monitoring solutions that are already using that command.
217+
Only one monitor program can reliably use RESET QSTATS on a particular queue manager, to avoid the information being split between them.
218218

219219
Statistics are available for pagesets and bufferpools, similar to the DISPLAY USAGE command.
220220

@@ -224,8 +224,7 @@ same channel name. For example, multiple users of the same SVRCONN definition. O
224224
platforms, the JOBNAME attribute does that job; for z/OS, the channel start date/time is
225225
used in this package as a discriminator, and used as the `jobname` label in the metrics.
226226
That may cause the stats to be slightly wrong if two instances of the same channel
227-
are started simultaneously from the same remote address. The sample dashboard showing z/OS
228-
status includes counts of the unique channels seen over the monitoring period.
227+
are started simultaneously from the same remote address. The sample dashboard showing z/OS status includes counts of the unique channels seen over the monitoring period.
229228

230229
### Authentication
231230
Monitors can be configured to authenticate to the queue manager,
@@ -257,24 +256,18 @@ values in a single string. If an option is provided on both the command line and
257256
that takes precedence. Not all strings need to be surrounded by quote characters in the file, but some (eg "!SYSTEM*")
258257
seem to need it. The example files have used quotes where they have been found to be necessary.
259258

260-
The field names are slightly different in the YAML file to try to make them a bit more consistent and
261-
structured. The command flags are not being changed to preserve compatibility with previous versions.
259+
The field names are slightly different in the YAML file to try to make them a bit more consistent and structured. The command flags are not being changed to preserve compatibility with previous versions.
262260

263-
User passwords can be provided in the file, but it is not recommended that you do that. Instead provide the password
264-
either on the command line or piped via stdin to the program.
261+
User passwords can be provided in the file, but it is not recommended that you do that. Instead provide the password either on the command line or piped via stdin to the program.
265262

266263
## Environment variable configuration for all exporters
267-
As a further alternative for configuration, parameters can be set by environment variables. This may be more
268-
convenient when running collectors in a container as the variables may be easier to modify for each container than
269-
setting up different YAML files. The names of the variables follow the YAML naming pattern with an IBMMQ prefix, underscore
270-
separators, and in uppercase.
264+
As a further alternative for configuration, parameters can be set by environment variables. This may be more convenient when running collectors in a container as the variables may be easier to modify for each container than setting up different YAML files. The names of the variables follow the YAML naming pattern with an IBMMQ prefix, underscore separators, and in uppercase.
271265

272-
For example, the queue manager name can be set with "IBMMQ_CONNECTION_QUEUEMANAGER"
266+
For example, the queue manager name can be set with `IBMMQ_CONNECTION_QUEUEMANAGER`.
273267
You can use the "-h" parameter to the collector to see the complete set of options.
274268

275269
### Precedence of configuration options
276-
The command line flags are highest precedence. Environment variables override settings in the YAML file, And the YAML
277-
override the hardcoded default values.
270+
The command line flags are highest precedence. Environment variables override settings in the YAML file, And the YAML overrides the hardcoded default values.
278271

279272
## More information
280273
Each of the sample monitor programs has its own README file describing any particular

cmd/mq_coll/exporter.go

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
package main
22

33
/*
4-
Copyright (c) IBM Corporation 2021
4+
Copyright (c) IBM Corporation 2022
55
66
Licensed under the Apache License, Version 2.0 (the "License");
77
you may not use this file except in compliance with the License.
@@ -195,13 +195,26 @@ func Collect() error {
195195
for key, value := range elem.Values {
196196
f := mqmetric.Normalise(elem, key, value)
197197
tags = map[string]string{
198-
"qmgr": config.cf.QMgrName,
198+
"qmgr": config.cf.QMgrName,
199+
"platform": platformString,
199200
}
200201

201202
series = "qmgr"
202203
if key != mqmetric.QMgrMapKey {
203204
series = "queue"
204205
tags[series] = key
206+
usage := ""
207+
if usageAttr, ok := mqmetric.GetObjectStatus("", mqmetric.OT_Q).Attributes[mqmetric.ATTR_Q_USAGE].Values[key]; ok {
208+
if usageAttr.ValueInt64 == 1 {
209+
usage = "XMITQ"
210+
} else {
211+
usage = "NORMAL"
212+
}
213+
}
214+
215+
tags["usage"] = usage
216+
tags["description"] = mqmetric.GetObjectDescription(key, ibmmq.MQOT_Q)
217+
tags["cluster"] = mqmetric.GetQueueAttribute(key, ibmmq.MQCA_CLUSTER_NAME)
205218
}
206219
printPoint(series, elem.MetricName, float32(f), tags)
207220
}

cmd/mq_influx/exporter.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
package main
22

33
/*
4-
Copyright (c) IBM Corporation 2016
4+
Copyright (c) IBM Corporation 2016,2022
55
66
Licensed under the Apache License, Version 2.0 (the "License");
77
you may not use this file except in compliance with the License.

dspmqrtj/go.mod

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,14 @@
11
module dspmqrtj/v5
22

3-
go 1.16
3+
go 1.17
44

55
require (
6-
github.com/ibm-messaging/mq-golang/v5 v5.3.1
6+
github.com/ibm-messaging/mq-golang/v5 v5.3.2
77
github.com/sirupsen/logrus v1.8.1
88
golang.org/x/crypto v0.0.0-20220126234351-aa10faf2a1f8
99
)
10+
11+
require (
12+
golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1 // indirect
13+
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1 // indirect
14+
)

dspmqrtj/go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
22
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
3-
github.com/ibm-messaging/mq-golang/v5 v5.3.1 h1:kBKY0a5gXm/2xGiWLWLm/UOeXyNYzf5LKuJrh2MJTJI=
4-
github.com/ibm-messaging/mq-golang/v5 v5.3.1/go.mod h1:ywCwmYbJOU/E0rl+z4GiNoxVMty68O+LVO39a1VMXrE=
3+
github.com/ibm-messaging/mq-golang/v5 v5.3.2 h1:PFbOddNpgy9/whl+mH77kO61zyEeNcm4SYs2bk58Kq8=
4+
github.com/ibm-messaging/mq-golang/v5 v5.3.2/go.mod h1:NELV8CYOIIH1QmY6pPvulRKjwuih9YAIL9rg8+UNzNw=
55
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
66
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
77
github.com/sirupsen/logrus v1.8.1 h1:dJKuHgqk1NNQlqoA6BTlM1Wf9DOH3NBjQyu0h9+AZZE=

0 commit comments

Comments
 (0)