IBM Support

Approaches to find out which queues are active in a queue manager

Question & Answer


Question

You want to know how to monitor the activity of the queues in a WebSphere MQ queue manager in order to find out which queues are active. For example, you are a new MQ Administrator and you are asked to clean up an existing queue manager by deleting those queues that are no longer used.

Answer

You could use the following 3 approaches:

a) Enable the online monitoring for queues

You can use runmqsc to enable the online monitoring of queues:

DISPLAY QMGR MONQ
     8 : DISPLAY QMGR MONQ
AMQ8408: Display Queue Manager details.
   QMNAME(QM_701)                          MONQ(OFF)

ALTER QMGR MONQ(LOW)
    11 : ALTER QMGR MONQ(LOW)
AMQ8005: WebSphere MQ queue manager changed.

... Wait an interval of time for the queues to be used.
In the example below, the queue Q1 received messages and thus, the LAST PUT DATE is not empty. However, Q3 did not see any action, thus, both LAST PUT DATE and LAST GET DATE fields are blank.

DISPLAY QSTATUS(*) LGETDATE LPUTDATE
     6 : display qstatus(*) lgetdate lputdate
AMQ8450: Display queue status details.
   QUEUE(Q1)                               TYPE(QUEUE)
   CURDEPTH(3)                             LGETDATE( )
   LPUTDATE(2012-07-30)
AMQ8450: Display queue status details.
   QUEUE(Q3)                               TYPE(QUEUE)
   CURDEPTH(0)                             LGETDATE( )
   LPUTDATE( )


b) Looking at the time stamp for the file "q"

You can look at the time stamp of the actual file used by the queue manager for storing messages for each queue.
Until MQ 7.1 (inclusive), the name of this file was "Q" in Windows or "q" in UNIX located under a directory with the name of the queue.
Starting with MQ 7.5, instead of a directory with the name of the queue, it is a file (thus, there is no "q" file).

cd MQ DATA PATH
cd qmgrs
cd queueManagerName
cd queues

Windows: Issue the "dir" command. In this case I am specifying to check all subdirectories and display the date/time/size for the file named "Q":
dir /s Q

 Directory of C:\var\mqm\Qmgrs\QM_701\queues\Q1
07/05/2012  11:35 AM             3,072 Q
 Directory of C:\var\mqm\Qmgrs\QM_701\queues\Q2
07/05/2012  11:35 AM             2,048 Q
 Directory of C:\var\mqm\Qmgrs\QM_701\queues\Q3
12/08/2011  04:48 PM             1,712 Q

As you can see, the "Q" files for the queues Q1 and Q2 have a time stamp of 07/05/2012. They were modified in July when these queues were used during a test. The file "Q" for the queue Q3 has a time stamp of 12/08/2011 because it has not been used since that date.

UNIX: You can issue:
   find . -type f -exec ls -l  {} \;

-rw-rw---- 1 mqm mqm 1712 2012-07-02 11:29 ./Q1/q


c) Use the MQ Explorer with the plugin from the SupportPac MS0P and enable the gathering of statistics for the queues in the queue manager.

You can exploit the functionality to report the statistics records provided by the plugin MS0P that is installed into the MQ Explorer.
SupportPac MS0P: WebSphere MQ Explorer - Configuration and Display Extension Plug-ins
The main plugin provides a mechanism to format Event messages, to aggregate the Statistics and Accounting reports generated by WebSphere MQ, and to see current activity on queues and channels.

After several days, you can view the statistics via the plugin and those queues that were active will be shown, and those are the queues that are your candidates to remain in place.

The following web page has an audio MP3 and a PDF presentation file for a webcast on gathering statistics:
Gathering and Displaying Statistics in WebSphere MQ V7
This WebSphere Support Technical Exchange is designed to present how to gather and display statistics in WebSphere MQ V7, by using the sample amqsmon and the SupportPac MS0P 'WebSphere MQ Explorer - Configuration and Display Extension Plug-ins'.

The rest of this note refers to the PDF file from the presentation.

- The Statistics Records are explained starting at page 26.

- You need to modify the properties of the queue manager to allow for the gathering of statistics for Queues.
ALTER QMGR STATQ(ON)
... or use the MQ Explorer as shown in page 28.

- By default, the Queues have a value for the gathering of statistics "STATQ" as being "QMGR" (shown by the MQ Explorer as "Queue Manager"). Thus, by enabling the overall gathering of queue statistics at the level of the queue manager, the statistics for the individual queues will be enabled by default.
DISPLAY QLOCAL(Q1) STATQ
   QUEUE(Q1)                               TYPE(QLOCAL)
   STATQ(QMGR)

- Install the plugin mentioned in page 5:
MS0P: WebSphere MQ Explorer - Configuration and Display Extension Plug-ins

- Perform some activities in the queues.

- Flush the statistics, see pages 31 and 32.

- Display the records via the MQ Explorer, see pages 50, 51 and 52.

In a test scenario, there were 3 queues: Q1, Q2, Q3
The gathering of statistics was enabled.
Messages were put in Q1 and Q2.
The queue Q3 was not touched.
The statistics were flushed.
The screen shot shows that there was activity in queues Q1 and Q2.
There is no mention of Q3.

For an illustration, see the picture of the "Events and Statistics" tab in attached file:
MQExplorer.plugin-MS0P.JPG

Thus, based on this picture, it is possible to conclude that Q3 was not used today.

From the "Events and Statistics" tab you can click on the icon that looks like a Diskette in order to save the data into a text file.
Then, you can look at the saved text file and search for the lines that have "Queue Name".

Windows: You could use the native Windows command "findstr" to find a string in a file. For some reason the following command provided every line that had "Queue" instead of "Queue Name":
findstr "Queue Name" *.txt
Instead, you can split the find string action into 2 commands and a pipe:
findstr "Queue" *.txt | findstr "Name"
events.txt: Queue Name : Q1
events.txt: Queue Name : Q2

UNIX: You could use the command:
grep "Queue Name" *.txt

MQExplorer.plugin-MS0P.JPGMQExplorer.plugin-MS0P.JPG

Attached file:
MQExplorer.plugin-MS0P.JPG

[{"Product":{"code":"SSFKSJ","label":"WebSphere MQ"},"Business Unit":{"code":"BU004","label":"Hybrid Cloud"},"Component":"Application \/ API","Platform":[{"code":"PF002","label":"AIX"},{"code":"PF010","label":"HP-UX"},{"code":"PF016","label":"Linux"},{"code":"PF027","label":"Solaris"},{"code":"PF033","label":"Windows"}],"Version":"8.0;7.5;7.1;7.0","Edition":""}]

Product Synonym

WMQ WebSphere MQ MQSeries

Document Information

Modified date:
15 June 2018

UID

swg21599886