Skip to content

Commit 53f6efe

Browse files
committed
Update for MQ 9.4.1
1 parent e93fd39 commit 53f6efe

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

85 files changed

+1771
-457
lines changed

CHANGELOG.md

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

4+
### Oct 24 2024 (v5.6.1)
5+
* Update to MQ 9.4.1
6+
* Some linter-suggested code changes
7+
* Add PasswordFile configuration option for MQ authentication
8+
* Add note about TZ configuration (#314)
9+
* Add an example dashboard for the OTel exporter to show any Traces sent to Jaeger
10+
411
### Jun 18 2024 (v5.6.0)
512
* Update to MQ 9.4.0
613
* Update all vendored dependencies
714
* Add OTLP/http option to OTel emitter
815
* Remove "EXPERIMENTAL" flag
916
* Convert OTEL and Prometheus sample dashboards to newer Grafana panels
1017
* Update to Go 1.21 as baseline (OTEL requirement)
11-
* Permit connection to unnamed (default) queue manager
18+
* Permit connection to unnamed (default) queue manager
1219

1320
### Mar 21 2024 (v5.5.4.1)
14-
* Update main Dockerfile to use different base build image
21+
* Update main Dockerfile to use different base build image
1522
because of glibc issues when copying into regular MQ container
1623

1724
### Feb 29 2024 (v5.5.4)
@@ -44,7 +51,7 @@ Newest updates are at the top of this file.
4451

4552
### Jan 10 2023 (v5.3.3)
4653
* Copy in metrics.txt summary of available metrics from mq-golang
47-
* JSON exporter - consistent objecttype for qmgr, merge published and
54+
* JSON exporter - consistent objecttype for qmgr, merge published and
4855
polled metrics (#188)
4956
* JSON exporter - allow configuration (`recordmax`) for number of objects
5057
printed in a single JSON record (also #188)
@@ -58,10 +65,10 @@ Newest updates are at the top of this file.
5865
* Add sample script showing TLS configuration in container
5966
* Update Prometheus channel status sample dashboard to show channel instance counts
6067
* Add AMQP channel status reporting to all collectors
61-
* Add single CLUSTER tag to queues (ibm-messaging/mq-golang#191)
68+
* Add single CLUSTER tag to queues (ibm-messaging/mq-golang#191)
6269

6370
### Jul 07 2022 (v5.3.1)
64-
* Update to use v5.3.1 of mq-golang repository
71+
* Update to use v5.3.1 of mq-golang repository
6572

6673
### Jun 23 2022 (v5.3.0)
6774
* Update to MQ 9.3.0

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ ARG EXPORTER
2727
ENV EXPORTER=${EXPORTER} \
2828
ORG="github.com/ibm-messaging" \
2929
REPO="mq-metric-samples" \
30-
VRMF=9.4.0.0 \
30+
VRMF=9.4.1.0 \
3131
CGO_CFLAGS="-I/opt/mqm/inc/" \
3232
CGO_LDFLAGS_ALLOW="-Wl,-rpath.*" \
3333
genmqpkg_incnls=1 \

Dockerfile.build

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ RUN mkdir -p $GOPATH/src $GOPATH/bin $GOPATH/pkg \
6060
# Location of the downloadable MQ client package \
6161
ENV RDURL="https://public.dhe.ibm.com/ibmdl/export/pub/software/websphere/messaging/mqdev/redist" \
6262
RDTAR="IBM-MQC-Redist-Linux${MQARCH}.tar.gz" \
63-
VRMF=9.4.0.0
63+
VRMF=9.4.1.0
6464

6565
# Install the MQ client from the Redistributable package. This also contains the
6666
# header files we need to compile against. Setup the subset of the package
@@ -78,6 +78,7 @@ RUN cd /opt/mqm \
7878
# Insert the script that will do the build
7979
COPY --chmod=777 scripts/buildInDocker.sh $GOPATH
8080

81+
ENV REPO="mq-metric-samples"
8182
WORKDIR $GOPATH/src/$ORG/$REPO
8283
COPY --chmod=777 go.mod .
8384
COPY --chmod=777 go.sum .
@@ -87,8 +88,8 @@ COPY --chmod=777 config.common.yaml .
8788

8889
# Copy the rest of the source tree from this directory into the container and
8990
# make sure it's readable by the user running the container
90-
ENV REPO="mq-metric-samples"
9191
COPY --chmod=777 . $GOPATH/src/$ORG/$REPO
9292

9393
# Set the entrypoint to the script that will do the compilation
94-
ENTRYPOINT $GOPATH/buildInDocker.sh
94+
WORKDIR $GOPATH
95+
ENTRYPOINT [ "./buildInDocker.sh" ]

Dockerfile.run

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ RUN apt-get update \
3434
# Location of the downloadable MQ client package \
3535
ENV RDURL="https://public.dhe.ibm.com/ibmdl/export/pub/software/websphere/messaging/mqdev/redist" \
3636
RDTAR="IBM-MQC-Redist-Linux${MQARCH}.tar.gz" \
37-
VRMF=9.4.0.0
37+
VRMF=9.4.1.0
3838

3939
# Install the MQ client from the Redistributable package. This also contains the
4040
# header files we need to compile against. Setup the subset of the package
@@ -70,4 +70,5 @@ ENV IBMMQ_GLOBAL_CONFIGURATIONFILE=/opt/config/$MONITOR.yaml
7070
# ENV IBMMQ_CONNECTION_QUEUEMANAGER=QM1
7171

7272
# The configuration file should be mounted from the host into the /opt/config directory.
73-
CMD /opt/bin/$MONITOR
73+
RUN ln /opt/bin/$MONITOR /opt/bin/mqmonitor
74+
CMD [ "/opt/bin/mqmonitor" ]

README.md

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ required to point at non-default directories for the MQ C SDK.
4949
### Building a component on your system directly
5050

5151
* You need to have the MQ client libraries installed first.
52-
* Create a directory where you want to work with the programs.
52+
* Create a directory where you want to work with the programs.
5353
* Change to that directory.
5454
* Use git to get a copy of this repository into a new directory in the workspace. For example:
5555

@@ -82,7 +82,7 @@ You still need to provide the configuration file at runtime, perhaps as a mounte
8282
```
8383
docker build -t mqprom:1.0 .
8484
docker run -p 9157:9157 -v <directory>/mq_prometheus.yaml:/opt/config/mq_prometheus.yaml mqprom:1.0
85-
```
85+
```
8686

8787
### Platform support
8888
This Dockerfile should work for a variety of platforms. For those with a Redistributable client, it uses `curl` to
@@ -260,8 +260,26 @@ The userid is configured using the `-ibmmq.userid` flag. The password can be set
260260
flag, or by passing it via stdin. That allows it to be piped from an external stash file or some other mechanism. Using
261261
the command line flags for controlling passwords is not recommended for security-sensitive environments.
262262

263+
You can also use the `-ibmmq.passwordFile` where the file contains a plaintext password. This might be appropriate for
264+
container environments where secrets are mounted into the running container.
265+
263266
Where authentication is needed for access to a database, passwords for those can also be passed via stdin.
264267

268+
### Timezones
269+
For some configurations, especially when running the exporters as client-connected rather than directly alongside
270+
the queue manager, you may see warnings about timezone offsets. Perhaps the exporter is in a different timezone
271+
than the queue manager. One particular warning would be: "Status reports appear to be from the future".
272+
273+
The `tzOffset` configuration attribute may help to deal with this - it indicates the difference between the queue manager
274+
timezone and the exporter's.
275+
276+
When running components in a container, you may also wish to adjust the container's timezone for consistency. This may
277+
need you to set the `TZ` environment variable for the container. You may also need to set timezone data files for the
278+
container as many standard container base images do not do that. See
279+
[here](https://access.redhat.com/solutions/2567961) for some ways to do that. The `Workaround 3` has been
280+
[reported](https://github.com/ibm-messaging/mq-metric-samples/issues/314) as being effective.
281+
282+
265283
## YAML configuration for all exporters
266284
Instead of providing all of the configuration for the exporters via command-line flags, you can also provide the
267285
configuration in a YAML file. Then only the `-f` command-line option is required for the exporter to point at the file.

TUNING.md

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ monitoring those queues. Some default configuration options might need tuning to
55
the frequency of generation and/or collection may be appropriate. There are several places where tuning might be
66
done: in this collector, in the database configuration, and in the queue manager.
77

8-
The following sections describe different pieces that you might want to look at.
8+
The following sections describe different pieces that you might want to look at.
99

1010
The document is mostly written from the viewpoint of using Prometheus as the database. That is mainly because
1111
Prometheus has the unique "pull" model, where the server calls the collector at configured intervals. Other databases and
@@ -20,13 +20,13 @@ If you cannot avoid running as a client (for example, you are trying to monitor
2020
network latency between the queue manager and collector as low as possible. For z/OS, you might consider running the
2121
collector in a zLinux LPAR on the same machine. Or perhaps in a zCX container.
2222

23-
If you are running as a client, then configure it to take advantage of readahead when getting publications. This is done by
23+
If you are running as a client, then configure it to take advantage of readahead when getting publications. This is done by
2424
setting `DEFREADA(YES)` on the nominated ReplyQueue(s).
2525

2626
## Collection processing time
2727
The collector reports on how long it takes to collect and process the data on each interval. You can see this in a debug
2828
log. The Prometheus collector also has a `ibmmq_qmgr_exporter_collection_time` metric. Note that this time is the value
29-
as seen by the main collection thread; the real total time as seen by Prometheus is usually longer. This is because there
29+
as seen by the main collection thread; the real total time as seen by Prometheus is usually longer. This is because there
3030
is likely still work going on in the background to send metrics to the database, and for it to be successfully ingested.
3131

3232
The first time that the collection time exceeds the Prometheus default `scrape_timeout` value, a warning message is
@@ -119,3 +119,14 @@ time. The default wait of 3 seconds can be tuned using the `connection.waitInter
119119
For all collectors _except_ Prometheus, a small number of these timeout errors are permitted consecutively. The failure
120120
count is reset after a successful collection. See _pkg/errors/errors.go_ for details. The Prometheus collector has an
121121
automatic reconnect option after failures, so does not currently use this strategy.
122+
123+
## Prometheus configuration
124+
There are some options that can be applied in the Prometheus configuration for reducing the number of metrics stored.
125+
These do not affect the collection from the queue manager, but Prometheus can apply filters during the collection phase
126+
so that only a subset is actually written to the database. This can be particularly relevant if you are then sending the
127+
data onwards to something like Grafana Cloud. The `metric_relabel_configs` section of Prometheus configuration seems to
128+
be the key area.
129+
130+
See
131+
[here](https://grafana.com/docs/grafana-cloud/cost-management-and-billing/reduce-costs/metrics-costs/client-side-filtering/)
132+
and [here](https://www.robustperception.io/dropping-metrics-at-scrape-time-with-prometheus/) for more details.

cmd/mq_aws/config.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,11 @@ func initConfig() error {
9595
// Process password for MQ connection
9696
if err == nil {
9797
if config.cf.CC.UserId != "" && config.cf.CC.Password == "" {
98-
config.cf.CC.Password = cf.GetPasswordFromStdin("Enter password for MQ: ")
98+
if config.cf.PasswordFile == "" {
99+
config.cf.CC.Password = cf.GetPasswordFromStdin("Enter password for MQ: ")
100+
} else {
101+
config.cf.CC.Password, err = cf.GetPasswordFromFile(config.cf.PasswordFile, false)
102+
}
99103
}
100104
}
101105

cmd/mq_aws/exporter.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -201,10 +201,10 @@ func Collect() error {
201201
if config.cf.RediscoverDuration > 0 {
202202
if elapsed >= config.cf.RediscoverDuration {
203203
log.Debugf("Doing queue rediscovery")
204-
err = mqmetric.RediscoverAndSubscribe(discoverConfig)
204+
_ = mqmetric.RediscoverAndSubscribe(discoverConfig)
205205
lastQueueDiscovery = thisDiscovery
206206
//if err == nil {
207-
err = mqmetric.RediscoverAttributes(ibmmq.MQOT_CHANNEL, config.cf.MonitoredChannels)
207+
_ = mqmetric.RediscoverAttributes(ibmmq.MQOT_CHANNEL, config.cf.MonitoredChannels)
208208
err = mqmetric.RediscoverAttributes(mqmetric.OT_CHANNEL_AMQP, config.cf.MonitoredAMQPChannels)
209209

210210
//}

cmd/mq_coll/config.go

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,9 @@ package main
1919
*/
2020

2121
import (
22-
cf "github.com/ibm-messaging/mq-metric-samples/v5/pkg/config"
2322
"os"
23+
24+
cf "github.com/ibm-messaging/mq-metric-samples/v5/pkg/config"
2425
)
2526

2627
type mqTTYConfig struct {
@@ -80,7 +81,11 @@ func initConfig() error {
8081

8182
if err == nil {
8283
if config.cf.CC.UserId != "" && config.cf.CC.Password == "" {
83-
config.cf.CC.Password = cf.GetPasswordFromStdin("Enter password for MQ: ")
84+
if config.cf.PasswordFile == "" {
85+
config.cf.CC.Password = cf.GetPasswordFromStdin("Enter password for MQ: ")
86+
} else {
87+
config.cf.CC.Password, err = cf.GetPasswordFromFile(config.cf.PasswordFile, false)
88+
}
8489
}
8590
}
8691

cmd/mq_coll/exporter.go

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@ import (
4141

4242
var (
4343
first = true
44-
errorCount = 0
4544
lastPoll = time.Now()
4645
lastQueueDiscovery time.Time
4746
platformString = ""
@@ -92,7 +91,7 @@ func Collect() error {
9291
pollError := err
9392
if pollStatus {
9493
if config.cf.CC.UseStatus {
95-
err := mqmetric.CollectQueueManagerStatus()
94+
err = mqmetric.CollectQueueManagerStatus()
9695
if err != nil {
9796
log.Errorf("Error collecting queue manager status: %v", err)
9897
pollError = err
@@ -164,9 +163,9 @@ func Collect() error {
164163
elapsed = thisDiscovery.Sub(lastQueueDiscovery)
165164
if config.cf.RediscoverDuration > 0 {
166165
if elapsed >= config.cf.RediscoverDuration {
167-
err = mqmetric.RediscoverAndSubscribe(discoverConfig)
166+
_ = mqmetric.RediscoverAndSubscribe(discoverConfig)
168167
lastQueueDiscovery = thisDiscovery
169-
err = mqmetric.RediscoverAttributes(ibmmq.MQOT_CHANNEL, config.cf.MonitoredChannels)
168+
_ = mqmetric.RediscoverAttributes(ibmmq.MQOT_CHANNEL, config.cf.MonitoredChannels)
170169
err = mqmetric.RediscoverAttributes(mqmetric.OT_CHANNEL_AMQP, config.cf.MonitoredAMQPChannels)
171170

172171
}
@@ -501,11 +500,6 @@ func printPoint(series string, metric string, val float32, tags map[string]strin
501500
return
502501
}
503502

504-
func fixup(s1 string) string {
505-
s2 := strings.Replace(s1, ".", "_", -1)
506-
return s2
507-
}
508-
509503
// Only the following characters are allowed in names: a to z, A to Z, 0 to 9, -, _, .,
510504
func sanitiseString(s string) string {
511505
r := make([]rune, len(s))

0 commit comments

Comments
 (0)