WM 2071 Xstud
WM 2071 Xstud
WM 2071 Xstud
cover
WebSphere Education
Student Exercises
Trademarks
IBM, the IBM logo, and ibm.com are trademarks or registered trademarks of International Business
Machines Corp., registered in many jurisdictions worldwide.
The following are trademarks of International Business Machines Corporation, registered in many
jurisdictions worldwide:
AIX® CICS® FFST™
First Failure Support HACMP™ iSeries®
Technology™
PartnerWorld® QMF™ System i®
System z® Tivoli® WebSphere®
z/OS®
Linux is a registered trademark of Linus Torvalds in the United States, other countries, or both.
Microsoft and Windows are trademarks of Microsoft Corporation in the United States, other
countries, or both.
UNIX is a registered trademark of The Open Group in the United States and other countries.
Java™ and all Java-based trademarks and logos are trademarks or registered trademarks of
Oracle and/or its affiliates.
VMware and the VMware "boxes" logo and design, Virtual SMP and VMotion are registered
trademarks or trademarks (the "Marks") of VMware, Inc. in the United States and/or other
jurisdictions.
Other product and service names might be trademarks of IBM or other companies.
TOC Contents
Trademarks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . v
Exercises description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ix
Exercise 2. Using IBM MQ Explorer to create queue managers and queues . . . . . . . . . . . 2-1
TMK
Trademarks
The reader should recognize that the following terms, which appear in the content of this training
document, are official trademarks of IBM or other companies:
IBM, the IBM logo, and ibm.com are trademarks or registered trademarks of International Business
Machines Corp., registered in many jurisdictions worldwide.
The following are trademarks of International Business Machines Corporation, registered in many
jurisdictions worldwide:
AIX® CICS® FFST™
First Failure Support HACMP™ iSeries®
Technology™
PartnerWorld® QMF™ System i®
System z® Tivoli® WebSphere®
z/OS®
Linux is a registered trademark of Linus Torvalds in the United States, other countries, or both.
Microsoft and Windows are trademarks of Microsoft Corporation in the United States, other
countries, or both.
UNIX is a registered trademark of The Open Group in the United States and other countries.
Java™ and all Java-based trademarks and logos are trademarks or registered trademarks of
Oracle and/or its affiliates.
VMware and the VMware "boxes" logo and design, Virtual SMP and VMotion are registered
trademarks or trademarks (the "Marks") of VMware, Inc. in the United States and/or other
jurisdictions.
Other product and service names might be trademarks of IBM or other companies.
pref
pref
Exercises description
This course includes the following exercises:
• Exercise 1, Using commands to create queue managers and queues
• Exercise 2, Using IBM MQ Explorer to create queue managers and
queues
• Exercise 3, Using IBM MQ sample programs to test the configuration
• Exercise 4, Implementing a trigger monitor
• Exercise 5, Using a media image to restore a queue
• Exercise 6, Running an IBM MQ trace
• Exercise 7, Connecting queue managers
• Exercise 8, Controlling access to IBM MQ
• Exercise 9, Connecting an IBM MQ client
• Exercise 10, Back up and restore IBM MQ object definitions
• Exercise 11, Monitoring and configuring IBM MQ for performance
In the exercise instructions, you can check off the line before each step as
you complete it to track your progress.
Most exercises include required sections that should always be completed. It
might be necessary to complete these sections before you can start the next
exercise. Some exercises might also include optional sections that you might
want to complete if you have sufficient time and want an extra challenge.
Exercise data that is required for the lab files is in C:\labfiles on Windows
and /usr/labfiles on Linux. There is a separate subdirectory for each lab.
For example, on Windows, the data directory for Exercise 11 is in the
C:\labfiles\Lab11\Data directory. On Linux, the data directory for Exercise
11 is in the /usr/labfiles/Lab11/data directory.
Exercise solutions for lab exercises with a defined solution are provided in a
Solution subdirectory in the lab files directory. For example, on Windows,
the solution script and report for Exercise 1 is in the
C:\labfiles\Lab01\Solution directory. On Linux, the solution for Exercise
1 is in the /usr/labfiles/Lab01/Solution directory.
Linux
If you are using the Linux VMware image, you might receive a message that one or more of the
system resources are set at an unusually low level. In the lab environment, you can ignore these
messages. In a real IBM MQ implementation, you must reconfigure the Linux kernel so that the
system resources are sufficient for your architecture.
EXempty
Exercise 1. Using commands to create queue
managers and queues
Introduction
In this exercise, you create and start a queue manager. You then create local
queues and alter queue and queue manager attributes.
You also create a script file of IBM MQ commands and run the command file
from a command.
Finally, you create alias queues and alter the queue attributes.
If you need more help, detailed steps are provided in the “Exercise
Instructions with Hints” section in this exercise.
Requirements
• IBM MQ is installed on the system
• A text editor
© Copyright IBM Corp. 2014 Exercise 1. Using commands to create queue managers and queues 1-1
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
Student Exercises
Exercise instructions
Linux
If you are using a Linux lab environment, create the queue manager with user-based authorizations
enabled by adding the -oa user option to the create queue manager command. This queue
manager (QMC01) is used in a security exercise later in this course (Exercise 8) that assumes that
user-based authorizations is enabled on the Linux queue manager. This option and topic are
described in more detail in Unit 10.
© Copyright IBM Corp. 2014 Exercise 1. Using commands to create queue managers and queues 1-3
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
Student Exercises
Linux
If you are using a Linux lab environment, create the queue manager with user-based authorizations
enabled by adding the -oa user option to the create queue manager command. Type:
crtmqm -oa user -q QMC01
This queue manager (QMC01) is used in a security exercise later in this course (Exercise 8) that
assumes that user-based authorizations is enabled on the Linux queue manager. This option and
topic are described in more detail in Unit 10.
EXempty __ d. Display all the attributes of the queue and verify that the text entered in the previous step
is the value for the DESC attribute.
Type: DISPLAY QL(QL.A)
__ e. Change the maximum number of messages that are allowed on the queue from 5000
messages to 1000 messages.
Type: ALTER QL(QL.A) MAXDEPTH(1000)
__ f. Display the queue attributes.
Type: DISPLAY QL(QL.A)
Was the modification successful and is the queue description unchanged?
__ g. Define a second local queue that is named QL.B with a text description.
Type: DEFINE QL(QL.B) REPLACE DESCR('QL.B Text')
__ h. Display all the attributes of the queue.
Type: DISPLAY QL(QL.B)
__ i. Change the maximum number of messages that are allowed on the queue to 2000 by
using the commands DEFINE with REPLACE instead of the ALTER command.
Type: DEFINE QL(QL.B) REPLACE MAXDEPTH(2000)
__ j. Display the queue attributes of QL.B.
Type: DISPLAY QL(QL.B)
Was the creation of the queue successful and is there a queue description?
__ 2. Exit the runmqsc mode.
Type: END
© Copyright IBM Corp. 2014 Exercise 1. Using commands to create queue managers and queues 1-5
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
Student Exercises
__ 2. Process the command file and direct the results to a file that is named report.txt.
__ a. In the command window, change directories to your lab files directory that contains the
MQSC file that you created in step 1.
__ b. Run the command file and redirect the output to report.txt.
Type: runmqsc QMC01 < exer1.mqsc > report.txt
__ 3. Using a text editor, open the file that is named report.txt and verify that each command
completed successfully.
© Copyright IBM Corp. 2014 Exercise 1. Using commands to create queue managers and queues 1-7
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
Student Exercises
EXempty
Exercise 2. Using IBM MQ Explorer to create
queue managers and queues
Introduction
In this exercise, you use IBM MQ Explorer to create a queue manager. Then,
you create local queues and modify queue properties. Finally, you create
queue manager sets to simplify the management of multiple queue
managers.
If you need more help, detailed steps are provided in the “Exercise
Instructions with Hints” section in this exercise.
Requirements
• IBM MQ and IBM MQ Explorer are installed on the system
• Successful completion of Exercise 1
• A text editor
© Copyright IBM Corp. 2014 Exercise 2. Using IBM MQ Explorer to create queue managers and 2-1
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
Student Exercises
Exercise instructions
Windows
From the Windows Start menu, click All Programs > IBM WebSphere MQ > WebSphere MQ
(Installation 1).
Linux
__ 2. Create a queue manager that is named QMC02 that uses a dead-letter queue that is named
QMC02.DLQ and listens on port 1416. Use this queue manager for all the remaining steps
in this exercise.
__ a. Right-click Queue Managers in the MQ Explorer Navigator and then click New > Queue
Manager.
__ b. For the Queue Manager name, enter QMC02. For the Dead-letter queue, enter
QMC02.DLQ. Click Next.
__ c. Accept the default values for logging. Click Next.
__ d. Accept the default values for the configuration options. Click Next.
__ e. On the listener options page, enter 1416 for the Listen on port number. Click Finish.
© Copyright IBM Corp. 2014 Exercise 2. Using IBM MQ Explorer to create queue managers and 2-3
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
Student Exercises
EXempty
© Copyright IBM Corp. 2014 Exercise 2. Using IBM MQ Explorer to create queue managers and 2-5
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
Student Exercises
EXempty __ e. In the Add Filter window, enter Production for the Filter Name.
__ f. The first part of the filter currently evaluates all queue managers. This filter should
evaluate all queue managers, so no changes are required to the first filter evaluation.
__ g. You need to add an AND clause to the filter that tests for the text Production in the
queue manager Description property. Select the AND check box, and then click Select.
__ h. In the Select Attribute window, scroll down, select the Description attribute, and then
click OK.
__ i. Complete the AND statement in the filter definition by setting the evaluation option to
equal to and entering Production.
© Copyright IBM Corp. 2014 Exercise 2. Using IBM MQ Explorer to create queue managers and 2-7
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
Student Exercises
__ j. Click OK.
__ k. Click OK in the Manage Filters window.
__ l. In the New Set window, select Production from the list of available filters and then click
Add to move it to the Selected filters pane.
© Copyright IBM Corp. 2014 Exercise 2. Using IBM MQ Explorer to create queue managers and 2-9
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
Student Exercises
EXempty
Exercise 3. Using IBM MQ sample programs to
test the configuration
Introduction
In this exercise, you test the queue manager QMC01 and queues that you
defined in Exercise 1 by using the MQ sample programs and MQ Explorer to
put, get, and browse messages.
Linux
The sample programs are in the samp/bin subdirectory. To run the sample programs, you must
modify the search path in the active window.
To modify your search path, type:
export PATH=$PATH:/opt/mqm/samp/bin/
Windows
The IBM MQ sample programs are run in a command window. The amqsput,
amqsget, and amqsbcg sample programs that are used in this exercise accept
two parameters. The first parameter is required and is the name of a queue.
The second parameter is optional and is the name of a queue manager. If the
© Copyright IBM Corp. 2014 Exercise 3. Using IBM MQ sample programs to test the configuration 3-1
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
Student Exercises
Requirements
• IBM MQ and IBM MQ Explorer
• Successful completion of Exercise 1
© Copyright IBM Corp. 2014 Exercise 3. Using IBM MQ sample programs to test the configuration 3-3
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
Student Exercises
Exercise instructions
© Copyright IBM Corp. 2014 Exercise 3. Using IBM MQ sample programs to test the configuration 3-5
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
Student Exercises
Windows
Linux
The sample program should run to completion and you should see the message that “All
valid MQSC commands were processed.”
__ 2. Use a sample program to put two messages on the local queue QL.A.
__ a. Type: amqsput QL.A
The program responds with:
Sample AMQSPUT0 start
target queue is QL.A
__ b. Enter some data and then press Enter. Each line of data that is entered becomes the
data portion of a new MQ message.
__ c. To end the sample program, press Enter on a blank line.
EXempty
Troubleshooting
__ 3. Use MQ Explorer to display the queue contents and browse the messages.
__ a. Select the Queue folder under QMC01 in the navigator to display the Queues content
view.
__ b. Right-click QL.A in the Queue contents view for QMC01 and click Browse messages.
The Message Browser list contains one message for every message that you entered
with the amqsput sample program.
__ c. Double-click a message from the list of messages to display its properties.
__ d. Click the Data properties tab to view the message data.
__ e. Click Close to close the Properties window.
__ f. Click Close to close the message browser window.
__ 4. Use a sample program to browse the messages on the queue QL.A. Direct the command
results to a file (or pipe to a UNIX paging program such as more) and view the results.
Type: amqsbcg QL.A > out.txt
If the program does not run successfully, can you determine the reason for the failure?
__ 5. Use a sample program to get the messages from the queue and empty the queue.
Type: amqsget QL.A
© Copyright IBM Corp. 2014 Exercise 3. Using IBM MQ sample programs to test the configuration 3-7
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
Student Exercises
The amqsget sample program can take a few seconds to run. It is finished when you see the
message:
no more message
Sample AMQGET0 end
If the program does not run successfully, can you determine the reason for the failure?
__ 6. Use the amqsput sample program to put some more messages on queues QL.A.
__ 7. Show the current depth (CURDEPTH) of QL.A and verify that the messages are on the
queue.
__ a. Open another command window.
__ b. Type: runmqsc QMC01
__ c. Type: DIS Q(Q*) CURDEPTH
__ 8. Define a new local queue that is named QL.X with the attributes of the alias queue QA.A.
In the window with MQSC running, type: DEF QL(QL.X) LIKE(QA.A)
Did you get an error?
Try to define a new local queue again, but use the attributes of the local queue QL.A.
In the MQSC window, type: DEF QL(QL.X) LIKE(QL.A)
__ 9. Use a sample program or MQ Explorer to put some messages on QL.X.
To use the sample program, type amqsput QL.X and then enter some text.
To use MQ Explorer, right-click QL.X in the Queues content view and then click Put Test
Message.
__ 10. Clear the messages from the local queue QL.A.
In the window that is running MQSC, type: CLEAR QL(QL.A)
__ 11. Clear the messages from the local queue QA.A.
In the MQSC window, type: CLEAR QA(QA.A)
Were you successful? Give the reason why.
__ 12. Delete the local queue QL.X.
In the MQSC window, type: DELETE QL(QL.X)
Was it successfully deleted? If not, modify the command clear to purge the queue and then
delete it. Type: DELETE QL(QL.X) PURGE
EXempty
To use MQSC, type: DIS QA(QA.A)
__ 2. If the PUT requests on the alias queue QA.A are allowed, change the queue PUT attribute
to inhibit them.
In window that is running MQSC, type: ALTER QA(QA.A) PUT(DISABLED)
__ 3. If the PUT requests on the local queue QL.B are allowed, change the queue PUT attribute to
inhibit them.
In window that is running MQSC, type: ALTER QL(QL.B) PUT(DISABLED)
__ 4. Use a sample program to try to put messages on both the alias and local queues.
Run the sample program in the command window.
For QL.A, type: amqsput QL.A
For QA.A, type: amqsput QA.A
For QL.B, type: amqsput QL.B
For QA.B, type: amqsput QA.B
The PUT request for QL.A succeeds but the other requests fail with reason code 2051
because PUT is inhibited. QA.B fails because it is an alias queue for QL.B, which has PUT
inhibited.
__ 5. Change the local queue QL.B to allow PUT requests.
In the MQSC window, type: ALTER QL(QL.B) PUT(ENABLED)
__ 6. Change the alias queue QA.A to allow PUT requests.
In the MQSC window, type: ALTER QA(QA.A) PUT(ENABLED)
__ 7. Use MQ Explorer to clear any messages on the local queues QL.A and QL.B.
__ a. In the Queues content view, right-click QL.A and then click Clear Messages.
__ b. Select Clear will be used using CLEAR command and then click CLEAR.
__ c. Click OK in the verification window.
__ d. Verify that the Current queue depth column value for QL.A is zero.
__ e. If there are any messages on QL.B, repeat steps a - d to clear QL.B.
Note
End of exercise
© Copyright IBM Corp. 2014 Exercise 3. Using IBM MQ sample programs to test the configuration 3-9
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
Student Exercises
EXempty
Exercise 4. Implementing a trigger monitor
Introduction
In this exercise, you implement a trigger monitor. You use a sample program
to put request messages on a queue that is enabled for triggering. The
trigger monitor starts the other sample programs and builds the reply
messages.
• amqsreq is run in a command window. The first parameter is the name of
the request queue, the second the queue manager name and the third is
the reply-to queue name.
The command to start the program is amqsreq Qname QmgrName
replyto_qname, for example amqsreq Q1 QMC01 RTQ1.
The program reads lines of text from the standard input device, converts
them to request messages, and then MQPUTs the messages on the
named queue.
When a blank line is entered, the program begins to MQGET the
messages from the reply-to queue and displays those messages on the
standard output device.
• A trigger monitor starts the amqsech program. The program connects to
the queue manager that is named in the structure that is passed to it by
the trigger monitor and then opens the queue that is also named in the
structure. This queue is called the request queue in the description that
follows.
The amqsech program gets a message from the request queue and
creates a message with the same application data as the original
message. It puts the new message on the reply-to queue named in the
message descriptor of the original message. The program then gets each
of the remaining messages on the request queue in turn and generates a
reply in the same way. When the request queue is empty, the program
closes the queue and disconnects from the queue manager.
• A trigger monitor starts the amqsinq program. The program connects to
the queue manager, opens the request queue, gets a message from the
queue, and interprets the application data as the name of a queue. The
amqsinq program opens the queue, calls MQINQ to inquire on the values
of three of its attributes, constructs a reply message with the attribute
values, and puts the message on the reply-to queue. The program then
gets each of the remaining messages on the request queue in turn and
generates a reply in the same way. When the request queue is empty, the
program closes the queue and disconnects from the queue manager.
If you need more help, detailed steps are provided in the “Exercise
Instructions with Hints” section in this exercise.
Requirements
• IBM MQ and MQ Explorer
• The sample programs amqsreq, amqsech, and amqsinq
• A text editor
• Successful completion of Exercise 1 and Exercise 3
Remember that amqsinq now expects the application data in each message to contain the
name of a queue. For example, you can use the names of the following queues:
SYSTEM.ADMIN.COMMAND.QUEUE
QM.REPLY
SYSTEM.SAMPLE.REPLY
QL.A
__ 4. Verity that the trigger monitor starts amqsinq in the trigger monitor window. In the window
where you entered the request, verify that amqsreq receives the request. The replies consist
of an Inquire on attributes of the named queues
__ 5. Alter the process object so the trigger monitor starts amqsinq as a separate asynchronous
process.
Run amqsreq again following the directions in Step 4 and verify that the triggered application
opens in a separate window (on Windows) or a background process (on Linux).
__ 6. Stop the trigger monitor (close the trigger monitor window).
__ 7. Clear all the messages on QL.A.
End of exercise
Windows
Linux
__ d. Define a model queue that is named QM.REPLY. The sample program amqsreq opens
this queue to create a temporary dynamic reply-to queue.
Type: DEFINE QMODEL(QM.REPLY) REPLACE
__ 2. Use runmqsc to process the command file. Open the report in a text editor and verify that all
the objects are successfully created. If unsuccessful, edit and rerun the command file until
all the objects are created.
Type: runmqsc QMC01 < trig.mqsc > trigreport.txt
__ 3. Use the runmqtrm control command to start the trigger monitor. Specify your queue
manager and the name of the initiation queue.
Type: runmqtrm -q QL.INITQ -m QMC01
You should see that the trigger monitor program is running and waiting for a message. Do
not close this window.
Linux
On Linux, you must modify the search path in the active window. Type:
export PATH=$PATH:/opt/mqm/samp/bin/
You must enter this command in every new command window that you use to run the sample
programs.
EXempty
Windows
Linux
The trigger monitor window should show that amqsinq is the process that started.
__ 5. Alter the process object so the trigger monitor starts amqsinq as a separate asynchronous
process.
Type the following commands according to your system type in MQSC for QMC01:
Linux
On UNIX systems, ENVRDATA can be set to the ampersand character to make an application that
is started run in the background. Type:
ALTER PROCESS(PR.INQ) ENVRDATA(‘&')
Windows
__ 6. Run amqsreq again following the directions in Step 4 and verify that the triggered application
opens in a separate window (on Windows) or a background process (on Linux).
__ 7. Stop the trigger monitor (close the trigger monitor window).
__ 8. Use MQSC or MQ Explorer to clear all the messages on QL.A if any exist.
End of exercise
EXempty
Exercise 5. Using a media image to restore a
queue
Introduction
This exercise demonstrates the survival of persistent messages across a
queue manager restart. It also demonstrates how a damaged queue can be
recovered from its media image.
In this exercise, you create a queue manager with a linear log. To
demonstrate media recovery, you then damage a queue. The act of
deliberately damaging a queue should not be done in practice. It is done in
this exercise to simulate a disk failure.
You can use the amqsbcg sample program or MQ Explorer to browse queues.
If you need more help, detailed steps are provided in the “Exercise
Instructions with Hints” section in this exercise.
Requirements
• IBM MQ and MQ Explorer installed on the local system
• Successful completion of Exercise 1 and Exercise 3
© Copyright IBM Corp. 2014 Exercise 5. Using a media image to restore a queue 5-1
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
Student Exercises
Exercise instructions
Linux
Before you run the MQ sample program on Linux, set the EXPORT in the command window:
export PATH=$PATH:/opt/mqm/samp/bin/
__ 7. Use the MQ Explorer or the sample program amqsbcg to browse the messages on the local
queue QL.A.
Verify that there is a mixture of persistent and non-persistent messages on the queue.
__ 8. Stop and then restart the queue manager QML01.
__ 9. Browse the messages on queue QL.A again.
Check that only the persistent messages are still on the local queue QL.A and that the
restart did not remove them.
EXempty __ 2. Locate the file that implements the local queue QL.B within the file system and damage the
queue by deleting the file. This file is called 'q'. The location of the file is specific to the
operating system.
__ 3. Use the MQSC command DISPLAY QUEUE to display the attributes of local queue QL.B.
This action still works because the queue manager does not have to access the queue file
to provide the requested information.
__ 4. Use amqsput to put some messages to local queue QL.B. It might take 10 or more
messages (because of buffering) but the queue manager eventually detects that the queue
is damaged and reports the damage by returning MQRC 2101
(MQRC_OBJECT_DAMAGED).
__ 5. Use the MQSC command DISPLAY QUEUE to display the attributes of local queue QL.B.
The queue manager reports an error now as it recognizes that the queue is damaged.
__ 6. Use the re-create object (rcrmqobj) command to recover local queue QL.B from its media
image.
__ 7. Check that you can now display the attributes of the queue.
__ 8. Browse the local queue QL.B again to check whether the messages are recovered
successfully. What about the non-persistent messages?
__ 9. Clear the messages from the QL.B.
__ 10. Stop and delete the queue manager QML01.
End of exercise
© Copyright IBM Corp. 2014 Exercise 5. Using a media image to restore a queue 5-3
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
Student Exercises
EXempty
Linux
Before you run the MQ sample program on Linux, set the EXPORT in the terminal window:
export PATH=$PATH:/opt/mqm/samp/bin/
When the amqsput sample program starts, the value of the DefPersistence attribute of the
queue determines whether the message that is put on the queue is persistent or
non-persistent. Because of the queue definitions you made is step 4, the amqsput sample
program puts persistent messages on the local queues and non-persistent messages on the
alias queues.
Type:
amqsput QL.A QML01
amqsput QA.A QML01
amqsput QL.B QML01
amqsput QA.B QML01
__ 7. Use the MQ Explorer or the sample program amqsbcg to browse the messages on the local
queue QL.A and QL.B and verify that there is a mixture of persistent and non-persistent
messages on it.
To use the sample program, type: amqsbcg QL.A QML01
The sample program returns a record for each message that is on the queue.
- If the message is persistent, the Persistence attribute is 1.
- If the message is not persistent, the Persistence attribute is 0.
To use MQ Explorer, right-click the queue in the Queues content view and then click
Browse Messages. There is a row for each message on the queue. Scroll to the right until
you see the Persistence column and verify that the queue contains both persistent and
non-persistent messages.
Linux
© Copyright IBM Corp. 2014 Exercise 5. Using a media image to restore a queue 5-5
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
Student Exercises
Linux
rm /var/mqm/qmgrs/QML01/queues/QL\!B
Windows
erase “C:\ProgramData\IBM\MQ\qmgrs\QML01\queues\QL!B”
/q
__ 3. Use the DISPLAY QUEUE command in runmqsc to display the attributes of local queue QL.B.
This command still works because it does not yet recognize that the queue is damaged.
Type:
runmqsc QML01
DIS Q(QL.B)
END
__ 4. Use amqsput to put some messages to local queue QL.B. It might take 10 or more
messages (because of buffering) but the queue manager eventually detects that the queue
is damaged and reports the damage by returning MQRC 2101
(MQRC_OBJECT_DAMAGED).
Type: amqsput QL.B QML01
__ 5. Use the DISPLAY QUEUE command in runmqsc to display the attributes of local queue QL.B.
Type:
runmqsc QML01
DIS Q(QL.B)
end
The queue manager now recognizes that a queue is damaged and reports that the MQ
object QL.B is not found.
__ 6. Use the re-create object (rcrmqobj) command to recover local queue QL.B from its media
image.
Type: rcrmqobj -m QML01 -t ql QL.B
You should see a message that indicates that the local queue QL.B was re-created.
EXempty __ 7. In runmqsc, check that you can now display the attributes of the queue. Type:
runmqsc QML01
DIS Q(QL.B)
end
__ 8. Use MQ Explorer or the sample program to browse the local queue QL.B to check whether
the messages are recovered successfully.
To use the sample program to browse the queue, type: amqsbcg QL.B QML01
To browse the messages by using MQ Explorer, right-click the QL.B queue in the Queues
content view and then click Browse Messages.
What about the non-persistent messages?
__ 9. Clear the messages from QL.A and QL.B by using a sample program or MQ Explorer.
To clear the messages by using a sample program, type: amqsget QL.B QML01
To clear the messages by using MQ Explorer, right-click the queue in the Queues content
view, click Clear Messages, and then click Clear.
__ 10. Stop and delete the queue manager QML01. It might take 1 or 2 minutes for the queue
manager to be deleted.
Type:
endmqm -i QML01
dltmqm QML01
End of exercise
© Copyright IBM Corp. 2014 Exercise 5. Using a media image to restore a queue 5-7
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
Student Exercises
EXempty
Exercise 6. Running an IBM MQ trace
Introduction
The trace function in MQ is used for problem determination or as a program
development aid. Service personnel might request that a scenario is
re-created and traced for solving error or unexpected results. The commands
that are used for controlling trace are:
• strmqtrc to enable tracing. The command has optional parameters that
specify the level of tracing. In this exercise, you use the -m parameter and
the queue manager name to specify the name of the queue manager.
• endmqtrc to end a trace. In this exercise, you use the -m parameter and
queue manager name to specify the name of the queue manager.
• dspmqtrc to format a trace file (UNIX only).
Requirements
• IBM MQ and IBM MQ Explorer.
• The exercise assumes that you defined the queue manager and queues
in Exercise 1 and that you are familiar with the sample programs that
were introduced in Exercise 3.
• The exercise requires sample programs amqsput and amqsget.
On Windows, sample programs can be run from any location within the
file system hierarchy.
On Linux, you must either reference the path when running the sample
program or export the path to the sample directory by entering the
following command:
export PATH=$PATH:/opt/mqm/samp/bin/
Windows
Windows
Note
When you use MQ Explorer to start a trace, you do not have the option of selecting specific
components to trace. The strmqtrc command allows you to identify specific components.
Step 2: Use the sample programs to put and get messages from a queue
__ 1. Use the amqsput sample program to write some sample messages to the local queue QL.A
on queue manager QMC01.
__ a. From a command prompt, type: amqsput QL.A QMC01
__ b. Enter some messages.
__ c. Press Enter on a blank line to exit the sample program.
__ 2. Use the amqsget sample program to get the messages from the local queue QL.A on queue
manager QMC01.
Windows
Linux
Files that are associated with trace are created in a fixed location in the file tree that is
/var/mqm/trace. These files must be formatted before they can be read.
__ 1. Go to the directory /var/mqm/trace
__ 2. From a command line, format the trace files:
Type: dspmqtrc *.TRC
The trace formatter program converts binary files that are named AMQppppp.TRC, where
ppppp is the process identifier (PID) that created the file into readable files that are named
AMQppppp.FMT.
__ 3. View the formatted trace files and examine the PUT and GET operations.
End of exercise
EXempty
Exercise 7. Connecting queue managers
Introduction
In this exercise, you must configure two queue managers. One of queue
managers (QMC01) is a local queue manager and the other queue manager
(QMR01) simulates a remote queue manager on a different system.
In this exercise, you configure two message channels between the queue
managers so that messages can flow in each direction. The local queue
manager is QMC01 that you created in Exercise 1. You create the simulated
remote queue manager QMR01 in this exercise. The following figure
summarizes the configuration requirements.
Requirements
• IBM MQ and IBM MQ Explorer
• Successful completion of Exercise 1 and Exercise 3
• The IBM MQ sample programs amqsput, amqsget, amqsreq, and amqsech
• A text editor
Note
There is a space character between the single quotation mark characters in the CONNAUTH attribute
of the ALTER QMGR command.
Important
The steps to disable channel and connection authentication are not standard practice.
Authentication is disabled in this exercise because security is not covered in this unit.
__ 4. In MQ Explorer, create a server connection channel (type SVRCONN) on the remote queue
manager QMR01.
__ 5. Connect to the remote queue manager QMR01 in MQ Explorer.
The remote queue manager should now be visible in the MQ Explorer Navigator as QMR01
on ‘localhost(9000)’.
Step 2: Define the channels and listener on the local queue manager
__ 1. Prepare an MQSC command file that is named ConnectLocal.mqsc to define the MQ
objects that are required for a connection between your local queue manager and the
remote queue manager.
__ a. Define a message channel (type = sender).
Also, verify that QMC01 now has a transmission queue that is named QMR01.
__ 4. Create and start a listener on 9001 for the local queue manager QMC01 in runmqsc.
Use the CONTROL(QMGR) option in the DEFINE LISTENER command to associate the
listener service with the queue manager. The listener service automatically starts when the
queue manager starts and stops when the queue manager stops.
Alternatively, you can start the MQ listener on 9001. From a command window, type:
runmqlsr -t TCP -p 9001 -m QMC01
If you use the runmqlsr command, you must use the endmqlsr command to manually stop
the service.
EXempty
Linux
__ 5. To eliminate any security errors and security configuration in this exercise, disable the use of
channel authentication and connection authentication on QMC01 and refresh the security
cache.
Note
There is a space character between the single quotation mark characters in the CONNAUTH attribute
of the ALTER QMGR command.
Important
The steps to disable channel and connection authentication are not standard practice.
Authentication is disabled in this exercise because security is not covered in this unit.
__ 4. In MQ Explorer, create a server connection channel (type SVRCONN) on the remote queue
manager QMR01.
__ a. Verify that the queue manager is connected to MQ Explorer.
__ b. Right-click the queue manager QMR01 in the Navigator and then click Remote
Administration.
Step 2: Define the channels and listener on the local queue manager
__ 1. Prepare an MQSC command file that is named ConnectLocal.mqsc to define the MQ
objects that are required for a connection between your local queue manager and the
remote queue manager.
__ a. Define a message channel (type = sender).
- Channel name = QMC01.QMR01 (where QMC01 is your local queue manager
name and QMR01 is the remote queue manager name)
- Protocol = TCP/IP
- Network address = localhost(9000) (where localhost is the host name and 9000 is
remote queue manager listener port)
- Transmission queue name = QMR01 (the same as the name of the remote queue
manager)
EXempty Type:
DEF CHL(QMC01.QMR01) CHLTYPE(SDR) REPLACE +
TRPTYPE(TCP) CONNAME('localhost(9000)') +
XMITQ(QMR01)
__ b. Define a receiver channel. The attributes must match the sender channel of the remote
queue manager. Type:
DEF CHL(QMR01.QMC01) CHLTYPE(RCVR) REPLACE +
TRPTYPE(TCP)
__ c. Create a transmission queue with the same name as the remote queue manager
QMR01. Type:
DEF QL(QMR01) REPLACE +
USAGE(XMITQ)
__ d. Define a dead-letter queue that is named DLQ. Type:
DEF QL(DLQ) REPLACE
__ e. Change the queue manager to use the queue that is named DLQ as its dead-letter
queue. Type:
ALTER QMGR DEADQ(DLQ)
__ 2. Use runmqsc to run the script file ConnectLocal.mqsc against the local queue manager
QMC01. Redirect the output to a text file that is named LocalReport.txt.
Type: runmqsc QMC01 < ConnectLocal.mqsc > LocalReport.txt
__ 3. Use MQ Explorer to verify that QMC01 now has two channels:
• A sender channel that is named QMC01.QMR01
• A receiver channel that is named QMR01.QMC01
Also, verify that QMC01 now has a transmission queue that is named QMR01.
__ 4. Create and start a listener on 9001 for the local queue manager QMC01 in runmqsc.
Use the CONTROL(QMGR) option in the DEFINE LISTENER command to associate the
listener service with the queue manager. The listener service automatically starts when the
queue manager starts and stops when the queue manager stops.
Linux
__ 5. To eliminate any security errors and security configuration in this exercise, disable the use of
channel authentication and connection authentication on QMC01.
In MQSC for QMC01, type:
ALTER QMGR CHLAUTH(DISABLED)
ALTER AUTHINFO(SYSTEM.DEFAULT.AUTHINFO.IDPWOS) +
AUTHTYPE(IDPWOS) CHCKCLNT(NONE)
REFRESH SECURITY
EXempty __ c. Create a transmission queue with the same name as QMC01. Type:
DEF QL(QMC01) REPLACE USAGE(XMITQ)
__ d. Define a dead-letter queue that is named DLQ. Type:
DEF QL(DLQ) REPLACE
__ e. Change the queue manager to use the queue that is named DLQ as its dead-letter
queue. Type:
ALTER QMGR DEADQ(DLQ)
__ 2. Use runmqsc to run the script file ConnectRemote.mqsc against the remote queue manager
QMR01. Redirect the output to a text file that is named RemoteReport.txt.
Type: runmqsc QMR01 < ConnectRemote.mqsc > RemoteReport.txt
__ 3. Use the report and MQ Explorer to verify that QMR01 now has two channels:
• A receiver channel that is named QMC01.QMR01
• A sender channel that is named QMR01.QMC01
Also, verify that QMR01 now has a transmission queue that is named QMC01.
__ 3. Use the sample program amqsput to send messages from the local queue manager QMC01
to the queue QL.A on the remote queue manager QMR01.
In a command window, type:
amqsput QRMT01 QMC01
__ 4. Use MQ Explorer to verify that the messages you sent in Step 3 are on queue QL.A on
QMR01.
You can also check the CURDEPTH attribute of the target queue.
__ 5. If the messages do not arrive, investigate the possible causes. Check the following items:
__ a. Is the local transmission queue empty?
__ b. Is the channel running?
__ c. Is the dead-letter queue of remote queue manager empty?
__ d. Inspect the error logs in both queue managers.
End of exercise
EXempty __ b. Define a reply queue on QMR01. The sample program amqsreq opens this queue to
create a temporary dynamic reply-to queue.
In MQSC for QMR01, type: DEFINE QMODEL(QM.REPLY) REPLACE
__ c. Restart the trigger monitor on queue manager QMC01. In a command window, type:
runmqtrm -q QL.INITQ -m QMC01
__ d. Put request messages on QL.A in the remote queue manager QMR01. Open a new
command window and type:
amqsreq QRMT01 QMR01 QM.REPLY
Enter a message and then press Enter twice.
__ e. Check for a reply of each request message.
__ f. Close the trigger monitor window to stop the trigger monitor.
End of exercise
EXempty
Exercise 8. Controlling access to IBM MQ
Introduction
In this exercise you use a non-privileged user ID of ‘oamlab’ to access MQ
objects, experience access failures, examine related diagnostic messages,
and apply the correct rules. You use the MQ Explorer and the setmqaut
command to apply OAM rules.
If you need more help, detailed steps are provided in the “Exercise
Instructions with Hints” section in this exercise.
Linux
On Linux and UNIX systems, all authorities are set at the group-level. In Exercise 1, you created the
queue manager so that you can set authorities at the user-level authority by entering the -oa user
option on the create queue manager command.
Requirements
• IBM MQ and IBM MQ Explorer.
• A text editor.
• MS0P “WebSphere MQ Events and Statistics plug-in” SupportPac to
examine MQ security events in MQ Explorer.
• In general, the IBM MQ Explorer can be used in these labs. Ensure that
the SYSTEM.ADMIN.SVRCONN channel is defined and your listener is
running.
• The queue manager and queues that are created in Exercise 1.
• A user that does not belong to the ‘mqm’ group or the ‘users’ group (on
Linux).
__ 4. Start a session (window) as a non-privileged user and follow the steps according to your lab
operating system.
Linux
On Linux, the non-privileged user ID of oamlab is defined. Open a new terminal window and set the
user to oamlab:
su -l oamlab
The password is: Web1sphere
Set the path to run the sample programs by entering:
export PATH=$PATH:/opt/mqm/samp/bin/
Windows
__ 5. As the non-privileged (oamlab) user, use a sample program to attempt to put a message to
queue QL.A on your queue manager QMC01.
You receive an error message with a reason code 2035 (MQRC_NOT_AUTHORIZED).
__ 6. As the administration user, use the MS0P “Events and Statistics” SupportPac to find a
record of the violation.
A security violation message is also written to the MQ error logs.
Windows
Linux
ACTION: Ensure that the correct level of authority has been set for this
entity against the required object, or ensure that the entity is a member of
a privileged group.
__ 7. As the administration user, use MQ Explorer or the setmqaut command to add connection
authority for the user “oamlab” to your queue manager.
Use the dspmqaut command to verify that the user has connect authority.
__ 8. As the administrator, give the user “oamlab” general API access (put, get, browse, inquire,
and set) to QL.A on your queue manager.
EXempty __ 9. In the command window that is running as “oamlab”, use the amqsbcg sample program on
QL.A to browse the queue and verify that the access is now allowed.
__ 10. In the command window that is running as “oamlab”, put a message on QL.A. This user
should now be able to put messages to QL.A.
__ 4. Start a session (window) as a non-privileged user and follow the steps according to your lab
operating system.
Linux
On Linux, a user ID of oamlab is defined. Open a new terminal window and set the user to oamlab:
su -l oamlab
The password is: Web1sphere
Set the path to run the sample programs by entering:
export PATH=$PATH:/opt/mqm/samp/bin/
Windows
On Windows, the non-privileged user ID is called oamlab. To start a command window as oamlab,
enter the following command from a Windows command prompt:
runas /user:oamlab cmd
__ 5. In the non-privileged (oamlab) user command window, use a sample program to attempt to
put a message to queue QL.A on your queue manager QMC01. Type:
amqsput QL.A QMC01
You receive an error message with a reason code 2035 (MQRC_NOT_AUTHORIZED)
__ 6. As the administration user, use the MS0P “Events and Statistics“ SupportPac to find a
record of the violation.
To view the Queue Manager Events in the MQ Explorer:
__ a. Right-click QMC01in the MQ Explorer navigator, click Event Messages > Format
Events.
__ b. Click OK on the WebSphere MQ Events and Statistics window.
__ c. In the Events and Statistics tab, find the last event that shows the access violation.
.
Windows
Linux
ACTION: Ensure that the correct level of authority has been set for this
entity against the required object, or ensure that the entity is a member of
a privileged group.
__ 7. As the administration user, use MQ Explorer or the setmqaut command to add connection
authority for the user “oamlab” to your queue manager. If you use the setmqaut
command, use the dspmqaut command to verify that the user has connect authority.
To use the setmqaut command to add connection authority for the user “oamlab”, type:
EXempty
__ 8. As the administrator, give the user “oamlab” general API access (put, get, browse, inquire,
and set) to QL.A on your queue manager.
To use the setmqaut command, type:
setmqaut -m QMC01 -t q -n QL.A -p oamlab +put +get +browse +inq +set
To use MQ Explorer:
__ a. Right-click the Queues folder under QMC01 in the navigator and then click Object
Authorities > Manage Authority Records.
__ b. Expand Specific Profiles. Select QL.A.
__ c. On the Users tab, click New and then type oamlab as the Entity Name.
__ d. Select Browse, Get, Inquire, Put, and Set authority under the MQI section. Click OK.
__ e. Click OK on the confirmation window.
__ f. Verity that the user has Browse, Get, Inquire, Put, and Set authorities, and then click
Close.
__ 9. In the command window that is running as “oamlab”, use the amqsbcg sample program on
QL.A to browse the queue and verify that the access is now allowed.
Type: amqsbcg QL.A QMC01
__ 10. In the command window that is running as “oamlab”, put a message on QL.A. This user
should now be able to put messages to QL.A.
Type: amqsput QL.A QMC01
Linux
If you are completing this exercise on Linux, you should see that when you add or remove
authorities for a user (oamlab), you are adding or removing authority for the entire user group.
__ 1. As the administration user, use MQ Explorer or the setmqaut command to remove the
specific profile that allows user “oamlab” from accessing QL.A.
Type: setmqaut -m QMC01 -t q -n QL.A -p oamlab -remove
__ 2. As the administration user, create a new generic profile that is called QL.*.TEST that allows
the user “oamlab” to access (browse, put, get, set, and inquire) queues.
Type: setmqaut -m QMC01 -t q -n QL.*.TEST -p oamlab +allmqi
__ 3. As the administration user, define a queue that is called QL.A.TEST in QMC01.
Type: DEFINE ql(QL.A.TEST)
__ 4. As the non-privileged user, try to access QL.A. You should get the 2035 error.
Type: amqsput QL.A QMC01
__ 5. As the non-privileged user “oamlab”, try to put a message to QL.A.TEST.
Type: amqsput QL.A.TEST QMC01
__ 6. As the administration user, use MQ Explorer or the dmpmqaut command to inspect the
profiles that apply to QL.A.TEST.
To use MQ Explorer to inspect the profiles that apply to QL.A.TEST, complete the following
steps:
1. Right-click the queue QL.A.Test in the Queues content view and then click Object
Authorities > Find Accumulated Authorities.
2. Select User and then type oamlab for the Entity name.
3. Click Refresh.
EXempty
To use to the dmpmqaut command to inspect the profiles that apply to QL.A.TEST, type:
dmpmqaut -m QMC01 -t q -p oamlab -n QL.A.TEST
It returns a summary of the profile. For example,
profile: QL.*.TEST
object type: queue
entity: oamlab@WETRAINING
entity type: principal
authority: allmqi
__ 4. How many times did you enter the MQSC command REFRESH SECURITY in this exercise?
None.
__ 5. Close the command window that is running as the user “oamlab”.
End of exercise
EXempty
Exercise 9. Connecting an IBM MQ client
Introduction
To put, browse, and get messages on your client system, use the sample
programs. A brief description of each of the programs you might use is
provided:
• amqsputc is started the same way as amqsput and has the same
parameter structure. But it connects as a WebSphere MQ client instead
of a direct connection to the WebSphere MQ server.
• amqsbcgc is started the same way as amqsbcg and has the same
parameter structure but it connects as a WebSphere MQ client.
• amqsgetc is started the same way as amqsget and has the same
parameter structure but it connects as a WebSphere MQ client.
To simplify running this exercise, use two console windows. Use one of the
console windows for running the sample programs. Use the other console
window for entering queue manager control and configuration commands.
If you need more help, detailed steps are provided in the “Exercise
Instructions with Hints” section in this exercise.
Requirements
• IBM MQ and IBM MQ Explorer.
Important
Important
In this lab, you are using MUSR_MQADMIN or ‘mqm’ for the MCAUSER user name. In a real
implementation, you would create an administrative user ID for MQ and use that ID for the
MCAUSER. Never use MUSR_MQADMIN or ‘mqm’ in a real implementation.
Important
Windows
Linux
Important
In this lab, you are using MUSR_MQADMIN or ‘mqm’ for the MCAUSER user name. In a real
implementation, you would create an administrative user ID for MQ and use that ID for the
MCAUSER. Never use MUSR_MQADMIN or ‘mqm’ in a real implementation.
Linux
export MQSERVER=QMC01_CLNT/TCP/’localhost(9001)’
Windows
SET MQSERVER=QMC01_CLNT/TCP/localhost(9001)
Linux
EXempty
Windows
EXempty
Exercise 10.Backing up and restoring IBM MQ
object definitions
Introduction
The IBM MQ dmpmqcfg control command can be used to back up and restore
a queue manager’s configuration. As an option, you can use the –o
setmqaut parameter to create setmqaut commands that can be used to
re-create the queue manager security definitions.
If you need more help during this exercise, the “Exercise Instructions with
Hints” section provides detailed instructions and commands.
Requirements
• IBM MQ and IBM MQ Explorer
• Successful completion of Exercise 1
© Copyright IBM Corp. 2014 Exercise 10. Backing up and restoring IBM MQ object definitions 10-1
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
Student Exercises
Exercise instructions
Important
Ensure that you use the -v option so that you do not overwrite the existing configuration in the lab
environment.
EXempty __ 4. Run the following command to write a formatted view of the current authorities for QL.A on
QMC01.
dmpmqaut -m QMC01 -n QL.A -t q
__ a. Note the format of this output.
__ b. Consider how the different format leads to different uses.
The dmpmqcfg command writes the security definitions as a list of setmqaut commands.
These commands can then be used to re-create the security definitions on a new queue
manager.
In contrast, the dmpmqaut command creates a formatted view of the authorities. The
formatted view is useful for finding all the authorities that are set against a particular MQ
object. The output cannot be used to re-create the security definitions without
reformatting.
End of exercise
© Copyright IBM Corp. 2014 Exercise 10. Backing up and restoring IBM MQ object definitions 10-3
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
Student Exercises
Important
Ensure that you use the -v option so that you do not overwrite the existing configuration in the lab
environment.
EXempty __ 3. Use an MQSC command to verify that messages on the SYSTEM queues on QMC01 are
intact.
In MQSC, type:
DIS QL(SYSTEM.*) WHERE(CURDEPTH GT 0)
Ensure that the queue depths match the queue depths reported in Step 2.1.
© Copyright IBM Corp. 2014 Exercise 10. Backing up and restoring IBM MQ object definitions 10-5
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
Student Exercises
EXempty
Exercise 11.Monitoring and configuring IBM MQ
for performance
Introduction
With the IBM MQ monitoring facilities, you can postprocess monitoring data
and monitor your queue manager online.
For postprocessing, the collected monitoring data is split into two categories:
1. Statistics monitoring
Statistics monitoring generates data about the activity of the queue
manager for a specified time interval.
Statistics monitoring is used to collect information about the performance
of various areas of the queue manager. You can collect data on the
queue manager, queues, and channels, and you can configure the
amount of information to collect.
After it is collected, the data is made available at regular intervals in the
form of PCF records that are written to the
SYSTEM.ADMIN.STATISTICS.QUEUE system queue, with one
message per subtype.
This information can be used for charging purposes or for generating
historical analysis of the operation or throughput of the IBM MQ system.
2. Accounting monitoring
Accounting monitoring generates data about the activity of an IBM MQ
connection.
Accounting monitoring collects information about each IBM MQ
connection and when the connection disconnects. This information is
written in the form of a PCF monitoring message to the
SYSTEM.ADMIN.ACCOUNTING.QUEUE system queue. As an option,
Interim messages can be written for long-running tasks.
© Copyright IBM Corp. 2014 Exercise 11. Monitoring and configuring IBM MQ for performance 11-1
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
Student Exercises
Requirements
In addition, the following are required:
• IBM MQ and IBM MQ Explorer
• Successful completion of Exercise 1 and Exercise 7
• The amqsput, amqsget, and amqsmon sample programs that are supplied
with IBM MQ
• The statsdata.txt text file in the C:\labfiles\Lab11\data directory
on Windows or the usr/labfiles/Lab11/data directory on Linux
• WebSphere MQ MS0P SupportPac installed in IBM MQ Explorer
Note
© Copyright IBM Corp. 2014 Exercise 11. Monitoring and configuring IBM MQ for performance 11-3
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
Student Exercises
Note
You can disable statistics generation on each queue or channel by setting the Queue statistics
(STATQ) or Channel statistics (STATCHL) attribute of the object to Off.
Windows
© Copyright IBM Corp. 2014 Exercise 11. Monitoring and configuring IBM MQ for performance 11-5
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
Student Exercises
Linux
__ 3. Use MQ Explorer to check the queue depth of queue ACCTG.STATS.Q1 and verify that the
queue contains 536 messages.
__ 4. Use the amqsget program to read messages from ACCTG.STATS.Q1.
In the command window, type:
amqsget ACCTG.STATS.Q1 QMC01
This command gets all the messages off the queue.
__ 5. Check the queue depth of ACCTG.STATS.Q1. It should now be 0.
__ 6. Now look at the accounting data that was generated as a result of using amqsput and
amqsget.
MQ provides a sample program that can be used to read and format statistics and
accounting data.
__ a. Open a new command window.
__ b. Use the MQ sample program amqsmon to read the accounting PCF messages from
SYSTEM.ADMIN.ACCOUNTING.QUEUE and write the results to text file.
Windows
Linux
EXempty generated to show MQI accounting, that is, the MQI operations that get each application
runs. The other message is generated to show queue accounting, that is, the details of the
queue that the application uses.
Note
For applications that use multiple queues, there is a separate message for each queue.
Look at the file and locate the MQI accounting and queue accounting messages for each
application.
Table 1 and Table 2 describes the fields in each message.
Table 1: MQI accounting fields
Field Description
QueueManager Name of the queue manager.
IntervalStartDate Date of the start of the monitoring period.
IntervalStartTime Time of the start of the monitoring period.
IntervalEndDate Date of the end of the monitoring period.
IntervalEndTime Time of the end of the monitoring period.
CommandLevel IBM MQ command level.
ConnectionId Connection ID for the task.
Sequence number (normally zero). Increments for each subsequent
SeqNumber
record for long running connections.
ApplicationName Name of the application (program name).
ApplicationPid Operating system process ID of the application.
ApplicationTid IBM MQ thread ID of the connection in the application.
User ID User ID context of the application.
Normally matches “StartTime,” except in the case of long-running
ConnDate
connections.
Normally matches “StartTime,” except in the case of long-running
ConnTime
connection.
ConnName Only written for client connections.
ChannelName Only written for client connections.
Normally matches “EndTime,” except in the case of long running
DiscDate
connections.
Normally matches “EndTime,” except in the case of long running
DiscTime
connections.
MQ_DISCONNECT_TYPE_NORMAL, application requested.
MQ_DISCONNECT_TYPE_IMPLICIT, abnormal application
DiscType termination.
MQ_DISCONNECT_TYPE_QMGR, queue manager broke the
connection (shutdown -i).
OpenCount Number of objects opened.
OpenFailCount Number of unsuccessful open object attempts.
© Copyright IBM Corp. 2014 Exercise 11. Monitoring and configuring IBM MQ for performance 11-7
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
Student Exercises
QueueDefinitionType • MQQDT_PREDEFINED
• MQQDT_PERMANENT_DYNAMIC
• MQQDT_TEMPORARY_DYNAMIC
OpenCount Number of times the application opened this queue in this interval.
Date of the first open of the queue in this recording interval. If the queue
OpenDate was already open at the start of this interval, this value is the date that
the queue was originally opened.
Time of first open of the queue in this recording interval. If the queue
OpenTime was already open at the start of this interval, this value is the time that
the queue was originally opened.
CloseCount Number of objects closed.
Date of final close of the queue in this recording interval. If the queue is
CloseDate
still open, then the value is not returned.
Time of final close of the queue in this recording interval. If the queue is
CloseTime
still open, then the value is not returned.
Number of messages that are successfully put to the queue (excluding
PutCount
MQPUT1 requests).
PutFailCount Number of unsuccessfully put message attempts.
Number of messages that are successfully put to the queue through
Put1Count
MQPUT1 requests.
Put1FailCount Number of unsuccessful MQPUT1 message attempts.
PutBytes Total number of bytes put.
PutMinBytes Smallest message size that is placed on the queue.
PutMaxBytes Largest message size that is placed on the queue.
GetCount Number of successful destructive MQGETs.
GetFailCount Number of unsuccessful destructive GETs.
GetBytes Number of bytes read in destructive GETs.
GetMinBytes Size of the smallest messages that are retrieved from the queue.
GetMaxBytes Size of the largest messages that are retrieved from the queue.
BrowseCount Number of successful non-destructive GETs.
BrowseFailCount Number of unsuccessful non-destructive MQGETs.
Number of bytes read in non-destructive MQGETs that returned
BrowseBytes
persistent messages.
BrowseMinBytes Size of the smallest messages that are browsed from the queue.
BrowseMaxBytes Size of the largest messages that are browsed from the queue.
GeneratedMsgCount Number of messages generated (report / event).
Shortest time a message remained on the queue before being retrieved
TimeOnQMin
(in microseconds).
Average time a message remained on the queue before being retrieved
TimeOnQAvg
(in microseconds).
© Copyright IBM Corp. 2014 Exercise 11. Monitoring and configuring IBM MQ for performance 11-9
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
Student Exercises
Note
Note
This part of the exercises assumes that you successfully completed Exercise 7, “Connecting queue
managers”.
__ 1. Restart queue manager QMR01 and verify that the listener is running.
__ 2. In MQ Explorer, connect the remote queue manager QMR01 on ‘localhost(9000)’.
__ 3. Define a new local queue that is named STATS.Q1 on QMC01.
__ 4. Define a remote queue that is called STATS.Q1.REMOTE on QMC01 for the STATS.Q1
queue on queue manager QMR01.
Set the following remote queue definition properties:
• Remote queue: STATS.Q1
• Remote queue manager: QMR01
• Transmission queue: QMR01
__ 5. Create a new local queue on QMC01 that is called STATS.Q2.
__ 6. You should now have three queues on QMC01 for statistics:
• A local queue that is named STATS.Q1
• A remote queue that is named STATS.Q1.REMOTE
• A local queue that is named STATS.Q2
__ 7. Start the sender channel QMC01.QMR01.
Ensure that the channel is in the “Running” status before continuing.
Note
The QMC01.QMR01 channel is the same channel that was used in Exercise 7, “Connecting queue
managers”.
© Copyright IBM Corp. 2014 Exercise 11. Monitoring and configuring IBM MQ for performance 11-11
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
Student Exercises
__ 9. Return to the command window you used to run the amqsput program.
Run amqsput again to put messages to the remote queue definition on queue manager
QMC01 to send messages over the channel from QMC01 to QMR01.
This command writes messages to the transmission queue (QMR01), which then is sent
across the channel to queue manager QMR02.
Windows
Linux
Windows
Linux
EXempty
Windows
Linux
© Copyright IBM Corp. 2014 Exercise 11. Monitoring and configuring IBM MQ for performance 11-13
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
Student Exercises
Note
© Copyright IBM Corp. 2014 Exercise 11. Monitoring and configuring IBM MQ for performance 11-15
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
Student Exercises
Table 3:
Time at which the last message was put to the queue since the queue
LPUTTIME
manager start. If no put time is available, the value shows as blank.
Date on which the last message was retrieved from the queue since the
queue manager start. A message that is browsed does not count as a
LGETDATE
retrieved message. If no get date is available, the value is shown as
blank.
Time at which the last message was retrieved from the queue since the
queue manager start. A browsed message does not count as a
LGETTIME
retrieved message. If no get time is available, the value is shown as
blank.
Current level of monitoring data collection for the queue. Possible
MONQ
values: OFF, LOW, MEDIUM, HIGH.
Age, in seconds, of the oldest message on the queue. The maximum
MSGAGE displayable value is 999 999 999. If the age exceeds this value, 999
999 999 is displayed.
__ 8. Disable statistics monitoring on the QMC01 queue manager.
__ 9. Disable accounting monitoring on the QMC01 queue manager.
__ 10. Disable online monitoring on the QMC01 queue manager.
End of exercise
© Copyright IBM Corp. 2014 Exercise 11. Monitoring and configuring IBM MQ for performance 11-17
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
Student Exercises
backpg
Back page