AMQSCLM: Preparing and running the sample
In order to run the cluster queue monitoring sample, you must configure the queue manager to securely accept incoming connection requests from applications running in client mode.
Before you begin
The following steps must be completed before running the cluster queue monitoring sample.
- Create a working queue on each queue manager for the internal
use of the sample.
Each instance of the sample needs a local non-cluster queue for exclusive internal use. You can choose the name of the queue. The example uses the name AMQSCLM.CONTROL.QUEUE. For example, on Windows, you can create this queue by using the MQSC command
You can leave the values of MAXDEPTH and MAXMSGL as default.DEFINE QLOCAL(AMQSCLM.CONTROL.QUEUE)
- Create a directory for error and information message logs.The sample writes diagnostic messages to report files. You must choose a directory in which to store the files. For example, on Windows, you can create a directory using the following command:
The report files created by the sample have the following naming convention:mkdir C:\AMQSCLM\rpts
QmgrName.ClusterName.RPT0n.LOG
- (Optional) Define the cluster queue monitoring sample as an IBM® WebSphere® MQ service.To monitor queues, the sample must always be running. To ensure that the cluster queue monitoring sample is always running, you can define the sample as a queue manager service. Defining the sample as a service means that AMQSCLM is started when the queue manager starts. You can use the following RUNMQSC example to define the cluster queue monitoring sample as an IBM WebSphere MQ service.
where <Install Root> is the location of your installation.define service(AMQSCLM) + descr('Active Cluster Queue Message Distribution Monitor - AMQSCLM') + control(qmgr) + servtype(server) + startcmd('<Install Root>\tools\c\samples\Bin\AMQSCLM.exe') + startarg('-m +QMNAME+ -c CLUSTER1 -q ABC* -r AMQSCLM.CONTROL.QUEUE -l c:\AMQSCLM\rpts') + stdout('C:\AMQSCLM\rpts\+QMNAME+.TSTCLUS.stdout.log') + stderr('C:\AMQSCLM\rpts\+QMNAME+.TSTCLUS.stderr.log')
Definition Description service Specifies the service name. You can choose the service name. descr Specifies a textual description of the service. control Indicates that the service starts and stops at the same time as the queue manager. servtype Indicates a server service object, meaning only one instance, can be executed at a time for this queue manager. startcmd Specifies the location and name of the program. startarg Specifies the arguments of the sample. Note the use of +QMNAME+. The name of the queue manager is automatically substituted. stdout The fully qualified file name to which standard output is redirected. The sample writes to this file only messages confirming that the sample has terminated. The sample does this because the standard error file has already closed in an earlier stage of the sample termination process. stderr The fully qualified file name to which standard error output is redirected. The sample writes to the standard error file any error messages prior to termination of the sample.
About this task
AMQSCLM -m QMgrName -c ClusterName (-q QNameMask | -f QListFile) -r MonitorQName
[-l ReportDir] [-t] [-u ActiveVal] [-i Interval] [-d] [-s] [-v]
Argument | Variable | Further Information |
---|---|---|
-m | QMgrName | The queue manager to monitor. |
-c | ClusterName | The cluster containing the queues to monitor. |
-q | QNameMask | The queue, or queues, to monitor. A trailing * monitors all queues with names that match zero or more trailing characters. |
-f | QListFile | The full path and file name of a file containing a list of queue names of queue name masks to monitor. The file must contain one queue name/mask per line. You can specify -q or -f, but not both. |
-r | MonitorQName | The local queue being used exclusively by the sample. |
-l | ReportDir | The directory path in which to store logged information messages in a set of wrapping<fn>For each queue manager and queue combination a report file is generated that is capped at a certain size. The logger always writes into the same file, but it also keeps the two previous versions of the file.</fn> report files. |
-t | (Optional) Enables the transfer of queued messages from inactive local queues to active queues. If not enabled, only new messages entering the cluster are dynamically routed to active instances of a queue. | |
-u | ActiveVal | (Optional) Automatically switches the CLWLUSEQ property of a monitored queue instance to ANY when it is inactive, and to the ActiveVal property when active. ActiveVal can be LOCAL or QMGR. If this argument is not set in a system where putting applications connect to the same queue manager, or where message transfer is enabled, then monitored queues must have a CLWLUSEQ value of ANY, or QMGR with the queue manager having a value of ANY. |
-i | Interval | (Optional) The time interval in seconds, at which the monitor checks the queues. Default is 300 seconds (5 minutes). |
-d | (Optional) Enables additional diagnostic output. Debug output might be useful when initially configuring the system, or when working with the sample code. | |
-s | (Optional) Enables minimal statistical output per interval. | |
-v | (Optional) Log report information to standard out, in addition to the report files. |
-m QMGR1 -c CLUS1 -f c:\QList.txt -r CLMQ -l c:\amqsclm\rpts -s
-m QMGR2 -c CLUS1 -q ABC* -r CLMQ -l c:\amqsclm\rpts -i 600
-m QMGR1 -c CLUSDEV -q QUEUE.* -r CLMQ -l c:\amqsclm\rpts -t -u QMGR -d
Q1
QUEUE.*
ABC
ABD
Procedure
What to do next
Check the status of the sample.
QMgrName.ClusterName.RPT01.LOG
QMgrName.ClusterName.RPT02.LOG
QMgrName.ClusterName.RPT03.LOG
Report files grow to a
maximum size of approximately 1 MB. When the RPT01 file
fills up, a new RPT01 file is created. The old RPT01 file
is renamed to RPT02. RPT02 is
renamed to RPT03. The old RPT03 is
discarded. - At startup
- At termination
- When it marks a queue ACTIVE or INACTIVE
- when it requeues messages from an inactive queue to an active instance, or instances
The sample creates an error message CLMnnnnE to report a problem that requires attention.
Every 30 minutes, the sample reports average processing time per polling interval, and elapsed processing time. This information is held in message CLM0045I.
- Time taken to process the queues (in milliseconds)
- Number of queues checked
- Number of active/inactive changes made
- Number of messages transferred
Report files might grow rapidly in debug mode, and quickly wrap. In this situation, the 1-MB size limit for individual files might be exceeded.