Developing your own resource monitoring program

You can develop your own program 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 meta data to discover what resource usage information is available, and on what topics, and then subscribe to the advertised topics.

The topic tree for the meta data has the following structure:

$SYS/MQ/INFO/QMGR/QMGR-NAME/Monitor/class[/instance]/type]
For a list of possible classes and types, see Monitoring system resource usage by using the amqsrua command, and also see Metrics published on the system topics in the main IBM® MQ documentation.
The source code for the amqsrua program is provided as an IBM MQ sample. You can use this program as a guide for creating your own monitoring program. You 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 Linux® and UNIX platforms, MQ_INSTALLATION_PATH/samp/
  • On Windows platforms, MQ_INSTALLATION_PATH\tools\c\Samples\
The amqsrua program subscribes to MQ resource usage topics and formats the resulting published PCF data. The program source provides a basic example of how to request and consume this type of administrative data. The amqsrua program 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.

When your program is ready, you must run it on an IBM MQ client that connects to the queue manager you are monitoring. See Setting up a queue manager to accept client connections.