This document contains official content from the BMC Software Knowledge Base. It is automatically updated when the knowledge article is modified.
TrueSight Middleware Monitor
BMC Middleware and Transaction Management
BMC Middleware Management Truesight Middleware and Transaction Monitor Truesight Middleware Monitor
How to use Policies to automatically register MQ objects like queue managers or local queues for monitoring?
Policies can be used to to address the object registration and add the new Queue managers or Queues automatically for monitoring as soon as the agent reports them to the topic service. A policy basically contains these aspects:
- Expression: These expression decide on what objects(subset) of all available objects, your policies would run, for example a queue manager or local queues.
- Policy Action: What is to be done for the objects selected by the expression, here in this case it would be select/register for monitoring.
- Object Policy: On what objects, do we need to run the expressions and then apply the policy actions. Object Policy is where we couple the Expressions and the Policy Action together.
- Agent Policies: On what agents does these Object Policies have to be run. Agent Policies also use another expressions to select which agents are to be considered.
So you should start with creating an expression. Please note, that expressions and object policies are defined based on object types, you can not create a single expression that selects both queues and queue managers in one go. It would require 2 separate expressions and other policy components.
Step 1: Create an expression.
Navigate to the Policies Tab. Ensure you are in edit mode.
Click the "+" to create a new expression (on the Expressions tab).
The expression Type must be " WebSphere MQ Local Queues" for registering local queues.
If you want the expression to include all Local queues except for System queues that need to be registered you can use the below expression.
A simple example to select all Local queues(excluding System queues) is: QType = 1 & QName =~ "^(?!SYSTEM).*"
If you want this expression for the queue managers, you can select " WebSphere MQ Queue Managers" as Type.
The expression you create must include all queue managers that need to be registered.
A simple example to select all queue managers is: QMgrName =~ ".*"
Note: Here dot-star (.*) represents wildcard characters. You can put some patterns in the regular expressions if you have certain naming conventions.
Example: APP1.* Or QMGR_.*
Step 2: Create a policy action.
However, if you'd still like to create a new one, then Click the "+" to create a new Policy Action (on the Policy Actions tab).
Select " Register Object". Name it as you like.
Step 3: Create Object Policies.
Click the "+" to create a new Object Policy (on the Object Policies tab).
Name it as you like, Type should be " WebSphere MQ Local Queues" for local queues.
If this is for registering queue managers, the Type would be " WebSphere MQ Queue Managers".
Select the expression from step 1 in Expressions tab.
Select the policy action from step 2 in Policy Actions tab.
Step 4: Associate the object policy to a new top level agent policy.
Click the "+" to create a new Agent Policy (on the Agent Policies tab). Name it as you like.
Choose an agent expression that includes hosts with your WMQ queue managers/queues. You can probably just use the same expression that's a part of your main agent policy.
For example: The Expression Type would be " BMTM Network Hosts" and would use an expression like this: Description =~ ".*TECH=.*WMQ.*"
So the policy would select all the agents which have a description as TECH=WMQ configured on them.
From the Object Policies tab, choose the object policy you created in step 3.
Note: You can set this expression on the agent using the agentpref command if not already done:
(Windows) agentpref --host <agent_hostname> --port <agent_port> --set-agent Description "TECH=WMQ"
(Linux) ./agentpref.sh --host <agent_hostname> --port <agent_port> --set-agent Description "TECH=WMQ"
Step 5: Running the policy.
You should see all your queue managers with the summary: "Register objects for monitoring".
The WMQ queue managers/queues should now be registered.