+

Search Tips | Advanced Search

Developing your own resource monitoring application

We can develop your own application to monitor system resources.

Each queue manager publishes resource usage data to topics. This data is consumed by subscribers to those topics. When a queue manager starts, the queue manager publishes a set of messages on meta-topics. These messages describe which resource usage topics are supported by the queue manager, and the content of the messages published to those topics. Administrative tools can subscribe to the metadata to discover what resource usage information is available, and on what topics, and then subscribe to the advertised topics.

The topic tree for the metadata has the following structure:
$SYS/MQ/INFO/QMGR/QMGR-NAME/Monitor/class[/instance]/type]
From IBM MQ Version 9.1.5 use the following structure for the metadata of the topic tree:
$SYS/MQ/INFO/QMGR/QMGR-NAME/Monitor/class[/resourceid]/type]
to clarify that we are specifying the resource being monitored, which has the maximum of 28 character application name, and to avoid confusion with internal metadata type attributes.

For a list of possible classes, see Monitor system resource usage by using the amqsrua command.

The source code for the amqsrua application is provided as an IBM MQ sample. We can use this sample application as a guide for creating your own monitoring application. We can retrieve the source for the sample from an IBM MQ client installation. The source file is named amqsruaa.c and is located in the samples directory:

  • On UNIX and Linux platforms, MQ_INSTALLATION_PATH/samp/
  • On Windows platforms, MQ_INSTALLATION_PATH\tools\c\Samples\

The amqsrua application subscribes to IBM MQ resource usage topics and formats the resulting published PCF data. The application source provides a basic example of how to subscribe to and consume this type of administrative data. The amqsrua application completes the following tasks:

  • Creates a non-durable subscription to the topics identified by the input parameters.
  • Calls MQGET repeatedly to get messages from the topics, and writes to stdout.
  • Writes a message for each MQI reason (other than MQRC_NONE).
  • Stops if there is a MQI completion code of MQCC_FAILED, or when the requested number of resource usage publications have been consumed.

Parent topic: System topics for monitoring and activity trace

Last updated: 2020-10-04