How to get MQ Cluster information using Programmab

2019-09-13 08:58发布

问题:

I have a mq cluster setup that has a few queue managers, some are full repositories and some are partial repositories.
A full repository is supposed to hold information(meta data?) about the entire cluster.
A partial repository will hold some information about the cluster.
How do I gather information about the entire cluster using Programmable Command Format?
Information about hosts, queue managers, full and partial repositories, cluster queues etc....

Update 1
I have tried the following code but this does not return cluster information.

PCFMessageAgent agent = new PCFMessageAgent(queueManager);
agent.setCheckResponses(false);
PCFMessage[] responses;
PCFMessage request = new PCFMessage(MQConstants.MQCMD_INQUIRE_CLUSTER_Q_MGR);
request.addParameter(MQConstants.MQCA_CLUSTER_Q_MGR_NAME, queueManager);

responses = agent.send(request);
String clusterName = (String)responses[0].getParameterValue(MQConstants.MQCA_CLUSTER_NAME);
String clusterInfo = (String)responses[0].getParameterValue(MQConstants.MQIACF_CLUSTER_INFO);
logger.info("Cluster Name [" + clusterName + "]");
logger.info("Cluster Information [" + clusterInfo + "]");

The last line prints out a null.

Update 2 The answer below suggests that MQCMD_INQUIRE_CLUSTER_Q_MGR is equivalent to runmqsc DISPLAY CLUSQMGR(*) command. Following is the output from this command

display clusqmgr(*)
     4 : display clusqmgr(*)
AMQ8441: Display Cluster Queue Manager details.
   CLUSQMGR(QM_FR1)                        CHANNEL(TO.QM_FR1)
   CLUSTER(CLUSTER1)                    
AMQ8441: Display Cluster Queue Manager details.
   CLUSQMGR(QM_FR2)                        CHANNEL(TO.QM_FR2)
   CLUSTER(CLUSTER1)                    
AMQ8441: Display Cluster Queue Manager details.
   CLUSQMGR(QM_PR1)                        CHANNEL(TO.QM_PR1)
   CLUSTER(CLUSTER1)                    
AMQ8441: Display Cluster Queue Manager details.
   CLUSQMGR(QM_PR2)                        CHANNEL(TO.QM_PR2)
   CLUSTER(CLUSTER1)                    
AMQ8441: Display Cluster Queue Manager details.
   CLUSQMGR(QM_PR3)                        CHANNEL(TO.QM_PR3)
   CLUSTER(CLUSTER1)                    
AMQ8441: Display Cluster Queue Manager details.
   CLUSQMGR(QM_PR3)                        CHANNEL(TO.QM_PR3)
   CLUSTER(CLUSTER1)                    

I was expecting a similar response with PCF in the code i have supplied, but i don't get this information.
So the question is How do I get this information using PCF? The above output is for a full repository queue manager.

回答1:

Use the following PCF commands

  • Inquire Cluster Queue Manager (MQCMD_INQUIRE_CLUSTER_Q_MGR) which is the equivalent of the MQSC command DISPLAY CLUSQMGR. In the linked page, you can see all the possible output parameters listed in the section headed with ClusterQMgrAttrs. You can remove the line in your code that is trying to retrieve the value of the MQIACF_CLUSTER_INFO - an INPUT-ONLY parameter - and replace that line with any one of the parameters listed in that section to retrieve whatever information it is that you want about this cluster queue manager.
  • Inquire Queue (MQCMD_INQUIRE_Q) with the MQIACF_CLUSTER_INFO parameter which is the equivalent of the MQSC command DISPLAY QUEUE(*) CLUSINFO. Please note, the MQIACF_CLUSTER_INFO parameter is an input qualifier to this command that causes cluster queues as well as local queues to be returned as answers.

As you correctly note, only the full repository queue manager knows everything about a cluster, so you need to make your inquiries against that queue manager in order to get the full picture.



标签: ibm-mq