Monitor system resource usage by using the amqsrua command
We can use the amqsrua command to query performance data that is related to the system resource usage of a queue manager.
About this task
The amqsrua sample program showcases a way to consume IBM MQ monitoring publications and display performance data that is published by queue managers. This data can include information about the CPU, memory, and disk usage. We can also see data equivalent to the STATMQI PCF statistics data. The data is published every 10 seconds and is reported while the command runs.We can run the command with just the queue manager name and interactively step through to choose the CLASS, then TYPE and then object parameters that are available for the queue manager at each step. If you know the CLASS, TYPE and object names for which you want to see information, we can specify them when you run the amqsrua command.
By default, the amqsrua program looks for statistics that are published by the queue manager under the topic tree $SYS/MQ/INFO/QMGR. Other components or applications can use a similar mechanism to publish under a different topic starting point. For example, the IBM MQ Bridge to Salesforce that is available on x86-64 Linux platforms, publishes statistics under $SYS/Application/runmqsfb. From IBM MQ Version 9.0.2, we can use the -p parameter to specify where amqsrua looks for the statistics for these other components on both Linux and Windows.
- -m
- Queue manager name. The queue manager must be running. If we do not specify a queue manager name, statistics for the default queue manager are displayed.
- -c
- CLASS name. IBM MQ resource usage publications are associated with a class. The classes represent the top level in the tree of metadata that describes the available resource usage information.
- CPU
- Returns information about CPU usage.
- DISK
- Returns information about disk usage.
- STATMQI
- Returns information about MQI usage.
- STATQ
- Returns information about per-queue MQI usage.
For classes available only with the IBM MQ Bridge to Salesforce, see Monitor the IBM MQ Bridge to Salesforce.
- -t
- TYPE name. IBM MQ resource usage publications are associated with a type within a class. Each publication includes the class and type that allows the class/type/element definitions to be found and the resulting publications to be handled. The class/type/element descriptions are published as metadata at queue manager startup.
- -o
- Object name. Resource usage publications are PCF messages that consist of a sequence of PCF elements. The PCF elements that are published for each class/type pair are advertised in the metadata. A leaf is stored in the tree that describes each element, thus allowing the elements to be processed.
- -p
- Metadata prefix. Specify a topic tree starting point where amqsrua can look for statistics that are published by queue managers. The default topic tree is $SYS/MQ/INFO/QMGR but other components or applications might publish statistics under a different topic tree starting point, for example, the IBM MQ Bridge to Salesforce publishes statistics under $SYS/Application/runmqsfb.
- -n
- Publication count. We can specify how many reports are returned before the command ends. The data is published approximately every ten seconds, so if you enter a value of 50, the command returns 50 reports over 500 seconds. If we do not specify this parameter, the command runs until either an error occurs, or the queue manager shuts down.
- -h
- Usage
Procedure
- From the samples directory, issue the following command to display the available data for the queue manager: On Linux, MQ_INSTALLATION_PATH/samp/bin:
./amqsrua -m QMgrNameOn Windows, MQ_INSTALLATION_PATH\tools\c\Samples\Bin64:amqsrua -m QMgrNameWhere
- QMgrName
- Specifies the name of the queue manager to query. The queue manager must be running.
The following options are available:
CPU : Platform central processing units DISK : Platform persistent data stores STATMQI : API usage statistics STATQ : API per-queue usage statistics Enter Class selection ==>- From the list of CLASS options, enter STATMQI.
==> STATMQI CONNDISC : MQCONN and MQDISC OPENCLOSE : MQOPEN and MQCLOSE INQSET : MQINQ and MQSET PUT : MQPUT GET : MQGET SYNCPOINT : Commit and rollback SUBSCRIBE : Subscribe PUBLISH : Publish Enter Type selection ==>- From the list of TYPE options, enter PUT.
==>PUT Publication received PutDate:20170329 PutTime:17045485 Interval:4 minutes,13.978 seconds Interval total MQPUT/MQPUT1 count 22 Interval total MQPUT/MQPUT1 byte count 25284 100/sec Non-persistent message MQPUT count 22 Persistent message MQPUT count 0 Failed MQPUT count 0 Non-persistent message MQPUT1 count 0 Persistent message MQPUT1 count 0 Failed MQPUT1 count 0 Put non-persistent messages - byte count 25284 100/sec Put persistent messages - byte count 0 MQSTAT count 0 Publication received PutDate:20170329 PutTime:17050485 Interval:10.001 seconds Interval total MQPUT/MQPUT1 count 1 Interval total MQPUT/MQPUT1 byte count 524 52/sec Non-persistent message MQPUT count 1 Persistent message MQPUT count 0 Failed MQPUT count 0 Non-persistent message MQPUT1 count 0 Persistent message MQPUT1 count 0 Failed MQPUT1 count 0 Put non-persistent messages - byte count 524 52/sec Put persistent messages - byte count 0 MQSTAT count 0
Results
We used the amqsrua sample program interactively to look at statistics that queue managers publish on the system topics under the metadata prefix $SYS/MQ/INFO/QMGR.Note: This task is created for an IBM MQ queue manager that is running at Version 9.0.2 on Linux. Classes and types of resource publications that are available for queue managers might be different depending on their configuration, version, and platform. Use the amqsrua interactively to find the classes, types, and elements that are available for your specific queue manager.
What to do next
To develop your own monitoring application, see Developing your own resource monitoring program.