MQ

 View Only

Start and Stop MQ Managed File Transfer Resource Monitors

By Avinash Ganesh posted Wed November 17, 2021 06:22 AM

  
In this blog post, we discuss newly introduced commands for MQ MFT resource monitors.  

Also, we will see a small set of usage examples of the new commands.

An MFT agent can monitor resources, for example, a queue or a directory to automate transfers. In MFT, this is known as resource monitoring. The monitors wait for a condition, such as the arrival of file(s) in a directory or the presence of a message in an IBM MQ queue, to be satisfied. When a condition on this resource is satisfied, the resource monitor starts a task, such as a file transfer. A resource monitor polls the resource at specified intervals, few seconds/minutes/hours etc. An agent can run multiple resource monitors attached to it. 

Until now, the only way to stop or restart a resource monitor was by restarting the agent altogether. But an agent might have had multiple 
resource monitors.Some may be working fine, and some may have encountered
errors. In such cases if one wanted to restart the failed
monitors it wasn't possible. Also if there were maintenance works carried out, stopping monitors for certain period of time was not possible. Additionally, avoiding
consumption of precious system resources was not possible. Instead the monitor kept on running, though it was unwanted in such cases. The new
commands, fteStartMonitor and fteStopMonitor introduced and added to MFT's command bundle, as part of MQ V9.2.2, are an answer to such woes.



Syntax of fteStartMonitor command
fteStartMonitor   [-p <configurationOptions>] 
-ma <agentName> [-mm <queueManager>] -mn <monitorName>
 [-w <timeout>] [-mquserid <user>] [-mqpassword <password>]


Syntax of fteStopMonitor command, 
fteStopMonitor   [-p <configurationOptions>]
-ma <agentName> [-mm <queueManager>] -mn <monitorName>
 [-w <timeout>]
[-mquserid <user>] [-mqpassword <password>]

The fields are self explanatory and -ma, -mn are mandatory for both the commands. 

Usage Examples

1)
Submit a command to start a resource monitor, 
C:\Users\Administrator>fteStartMonitor -ma SOURCE -mn MNTR
5724-H72 Copyright IBM Corp.  2008, 2021.  ALL RIGHTS RESERVED
BFGCL0816I: A request to start resource monitor 'MNTR' of agent 'SOURCE' has been issued.
BFGCL0251I: The request has successfully completed.

2) Submit a command to stop a resource monitor,
C:\Users\Administrator>fteStopMonitor -ma SOURCE -mn MNTR
5724-H72 Copyright IBM Corp.  2008, 2021.  ALL RIGHTS RESERVED
BFGCL0813I: A request to stop resource monitor 'MNTR' of agent 'SOURCE' has been issued.
BFGCL0251I: The request has successfully completed.

3) Submit a command to start a resource monitor that is already in “started” state
C:\Users\Administrator>fteStartMonitor -mn MNTR -ma SOURCE
5724-H72 Copyright IBM Corp.  2008, 2021.  ALL RIGHTS RESERVED
BFGCL0816I: A request to start resource monitor 'MNTR' of agent 'SOURCE' has been issued.
BFGCL0814I: Resource monitor 'MNTR' of agent 'SOURCE' is already started.

4) Submit a command to stop a resource monitor that is already in “stopped” state
C:\Users\Administrator>fteStopMonitor -mn MNTR -ma SOURCE
5724-H72 Copyright IBM Corp.  2008, 2021.  ALL RIGHTS RESERVED
BFGCL0813I: A request to stop resource monitor 'MNTR' of agent 'SOURCE' has been issued.
BFGCL0815I: Resource monitor 'MNTR' of agent 'SOURCE' is already stopped.

5) Submit a command to start a resource monitor in an agent that is stopped
C:\Users\Administrator>fteStartMonitor -mn MNTR -ma SOURCE
5724-H72 Copyright IBM Corp.  2008, 2021.  ALL RIGHTS RESERVED
BFGCL0816I: A request to start resource monitor 'MNTR' of agent 'SOURCE' has been issued.
BFGCL0253W: No acknowledgement to command from agent within timeout.

6) Submit a command to start a resource monitor which is non-existent (Same would be the case with stop monitor)
C:\Users\Administrator>fteStartMonitor -mn UNKNOWNMONITOR -ma IJQ
5724-H72 Copyright IBM Corp.  2008, 2021.  ALL RIGHTS RESERVED
BFGCL0816I: A request to start resource monitor 'UNKNOWNMONITOR' of agent 'IJQ' has been issued.
BFGCL0250E: The monitor could not be found on the given agent.


Important points/features to be kept in mind

By default, the monitor will start if the agent restarts. This is the monitor behavior presently and it will continue. i.e., a monitor is automatically started on restart of its agent, even if the monitor previously was stopped using the fteStopMonitor command. Below is the behavior of the monitors based on the respective commands when run,

fteStartMonitor is issued --> if agent is running then monitor is started if it is currently stopped

fteStopMonitor is issued --> if agent is running then monitor stopped if currently started

fteStartAgent is issued --> monitor started as part of agent start up regardless of earlier calls to fteStopMonitor

fteStopAgent is issued  --> any running monitors will be stopped

- Any fteStopMonitor/fteStartMonitor requests while the agent is stopped will be discarded when the agent is restarted the next time. 

- An agent will process stop monitor requests serially rather than in parallel (for example, if an agent receives a request to stop monitor M1 and then another request to stop monitor M2 in quick succession, it will stop M1 first before trying to stop M2).

Permalink