Backing up and restoring MFT resource monitors

We can back up the resource monitors to have available for future use by exporting their definitions to an XML file that we can then import to create a new resource monitor from the backup.


You might need to back up the resource monitors that we have previously defined so that we can re-use their definitions in the future, for example to re-create the resource monitors in a different infrastructure or if a resource monitor needs to be re-created because of queue manager issues.

We can back up a single resource manager definition by using either the fteCreateMonitor command or the fteListMonitors command with the -ox parameter. In both cases, the resource manager definition is backed up by exporting it to an XML file. We can then use the -ix parameter of the fteCreateMonitor command to create a new resource manager by importing the definition from the XML file.

With the -ox parameter, we can back up only one resource monitor definition at a time.

From IBM MQ Version 9.0.5, the -od parameter is added to the fteListMonitors command. By specifying this parameter, we can back up more than one resource monitor at a time by exporting their definitions in bulk to a specified directory. Each resource monitor definition is saved to a separate XML file with a name in the format agent name.monitor name.xml.

The -od parameter is particularly useful if we have a large number of resource monitors to back up because you need to run the fteListMonitors -od command once only, instead of having to run the fteListMonitors -ox command separately for each resource definition, or use a separate script to run the fteListMonitors -ox command for each resource monitor.


Procedure

  • To back up the definition of one resource monitor by exporting it to an XML file, use either of the following commands:

    • The fteCreateMonitor command with the -ox parameter.
    • The fteListMonitors command with the -ox parameter.
    When you are using the -ox parameter, you must also specify the -ma and -mn parameters, as shown in the following example:
    fteListMonitors -ma AGENT1 -mn MONITOR1 -ox filename1.xml
  • To back up multiple resource monitor definitions by exporting them to XML files in a specified directory, use the fteListMonitor command with the -od parameter as shown in the following example:
    fteListMonitors -od /usr/mft/resmonbackup
    You must specify a valid target directory when you are backing up resource monitors in bulk. Not specifying a target path results in an error message as shown in the following example:
    BFGCL0762E: Output directory not specified. Rerun the command specifying a valid path.
    The -od parameter must not be combined with the -ox parameter, otherwise the following error message is displayed:
    BFGCL0761E: It is not valid to specify both the '-od' and '-ox' parameters together.
    We can define a particular set of resource monitors to include in the backup. For instance, by using the -ma parameter to specify the name of an agent, we can back up all the resource monitors for that agent, as shown in the following example:
    fteListMonitors -ma AGENT1 -od /usr/mft/resmonbackup
    We can also use wildcard matching by including an asterisk character (*) character when defining a pattern to use for matching agent names or monitor names, or both. The following example backs up all the resource monitors that have names matching a specified pattern and that are in an agent with a name matching a specified pattern:
    fteListMonitors -ma AGENT* -mn MON* -od /usr/mft/resmonbackup
    While the command is running, it displays the following progress report messages:
    A total of number matching resource monitor definitions found.
    index of number resource monitor definitions saved to file system.
    If you are using the verbose option, the running total is still displayed, but instead of displaying
    index of number resource monitor definitions saved to file system
    the command displays the name of the monitor definition being saved, for example:
    BFGCL0762I: Definition of monitor 'FILEMON' of agent ‘XFERAGENT' saved as FILEMON.XFERAGENT.XML to file system.
  • To back up one resource monitor for a particular agent by exporting it to an XML file in a specified directory, use the fteListMonitor command with the -od parameter:
    fteListMonitors -ma AGENT1 -mn MONITOR1 -od /usr/mft/resmonbackup 

    Use the -od parameter to back up a single resource monitor is similar to using the -ox parameter, except that the output file name is in the format agent name.monitor name.xml.

  • To restore resource monitor definitions from a backup, use the fteCreateMonitor command with the -ix parameter as shown in the following example:
    fteCreateMonitor -ix file name
    For more examples of how to use the -od parameter, see fteListMonitors: list MFT resource monitors.