You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+44-51Lines changed: 44 additions & 51 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,7 +1,7 @@
1
1
# mq-metric-samples
2
2
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)
5
5
to provide programs that can be used with existing monitoring technologies
6
6
such as Prometheus, AWS CloudWatch, etc. Statistics and status information
7
7
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.
19
19
There are also no guarantees of compatibility with any future versions of the package;
20
20
interfaces and functions are subject to change based on any feedback.
21
21
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.
23
23
Those packages are in the [mq-golang repository](https://github.com/ibm-messaging/mq-golang)
24
24
and are also included in the `vendor` tree of this repository. They are referenced in the `go.mod`
25
25
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`.
30
30
31
31
You will require the following programs:
32
32
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
35
35
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.
38
36
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
* 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`)
63
62
* All the prereq packages are already available in the vendor directory, but you can run `go mod vendor` to reload them
64
63
65
64
* From this root directory of the repository you can then compile the code. For example,
66
65
67
66
```
68
-
cd $GOPATH/src/github.com/ibm-messaging/mq-metric-samples
67
+
cd ./src/github.com/ibm-messaging/mq-metric-samples
69
68
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
71
71
```
72
72
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
74
74
monitor agent directory also has sample scripts, configuration files etc to help
75
75
with getting the agent running in your specific environment.
76
76
77
+
The `-mod=vendor` option is important so that the build process does not need to
78
+
download additional files from external repositories.
79
+
77
80
## Using a Docker container to build the programs
78
81
You can use the `buildMonitors.sh` script in the `scripts` subdirectory to build a Docker container that
79
82
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
97
100
estimated based on holding one minute's amount of publications; the number of monitored channels is also
98
101
used as an estimate, although that does not need to be time-based as the data is requested directly by the
99
102
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.
103
104
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.
104
107
105
108
### Using durable subscriptions
106
109
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.
131
134
### Wildcard Patterns for Queues
132
135
The sets of queues to be monitored can be given either directly on the command line with the
133
136
`-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.
135
138
136
139
The parameter can include both positive and negative
137
140
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
151
154
the queue patterns, with `-ibmmq.monitoredChannels` or `-ibmmq.monitoredChannelFile`.
152
155
Unlike the queue monitoring, wildcards are handled automatically by the channel
153
156
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.
156
158
157
159
Another parameter is `pollInterval`. This determines how frequently the
158
160
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
166
168
will leave no trace in the status or metrics.
167
169
168
170
#### 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
170
172
as metrics. The key values returned include the status and number of messages processed.
171
173
172
174
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
203
205
configuration attribute to true.
204
206
205
207
### 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
208
210
connectivity that allows an application to connect to the z/OS system.
209
211
210
212
The `-ibmmq.useStatus` (command line) or `useObjectStatus` (YAML) parameter must be set to `true` to use the DIS QSTATUS command.
211
213
212
214
There is also support for using the RESET QSTATS command on z/OS. This needs to be explicitly enabled
213
215
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.
218
218
219
219
Statistics are available for pagesets and bufferpools, similar to the DISPLAY USAGE command.
220
220
@@ -224,8 +224,7 @@ same channel name. For example, multiple users of the same SVRCONN definition. O
224
224
platforms, the JOBNAME attribute does that job; for z/OS, the channel start date/time is
225
225
used in this package as a discriminator, and used as the `jobname` label in the metrics.
226
226
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.
229
228
230
229
### Authentication
231
230
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
257
256
that takes precedence. Not all strings need to be surrounded by quote characters in the file, but some (eg "!SYSTEM*")
258
257
seem to need it. The example files have used quotes where they have been found to be necessary.
259
258
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.
262
260
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.
265
262
266
263
## 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.
271
265
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`.
273
267
You can use the "-h" parameter to the collector to see the complete set of options.
274
268
275
269
### 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.
278
271
279
272
## More information
280
273
Each of the sample monitor programs has its own README file describing any particular
0 commit comments