Using Perl scripts to automate actions

Perl scripts can be used to automate numerous actions within TrueSight Middleware and Transaction Monitor and your WebSphere MQ environment. TrueSight Middleware and Transaction Monitor includes a pre-installed set of Perl executables for this use.

Earlier releases of the product required you to install Perl from a third party, but in this release, Perl is included. Support for use of an external Perl still exists in this release but is deprecated and might be removed in future releases. 

Related topic

Before you begin

The queue manager must exist and must be running. You cannot create a queue manager using this procedure.

To automate actions

  1. Run one of the following Perl scripts in InstallDir\automation to install Perl automation files for TrueSight Middleware and Transaction Monitor and WebSphere MQ:
    • autocmd.pl
    • secure_autocmd.pl
  2. Use Windows Scheduler or cron on UNIX to call the Perl script.
  3. Ensure that the TrueSight Middleware and Transaction Monitor Agent and Configuration Extension (qpcfg) are running on the systems on which you wish to take any action.

A Perl script uses an API to call the BMC Configuration Extension (qpcfg) to execute a command.

The command that you must enter or include in a file that is called from Windows Scheduler or cron is:

perl [autocmd.pl|secure_autocmd.pl] hostname user password <options>

where:

  • autocmd.pl or secure_autocmd.pl  is the name of the Perl script used to automate several tasks, including exporting and importing queue managers. Use secure_autocmd.pl if your Agent is running in secure mode.
  • hostname is the name of the system where the agent you want to perform commands against exists.
  • user is the user account used to access the system where the TMTM Configuration Agent queue manager you want to perform commands against exists. This is a TrueSight Middleware and Transaction Monitor user name.
  • password is the password contained in autocmd.pl.
    autocmd.pl is in plain text, so if security is a major concern, consider creating a user that has permission to perform commands against queue manager definitions only. Then use that user name and password.


options
 - different options are needed depending on the object you want to perform actions against.

  • object: type of object on which you want to take action.
    Valid objects: qmgr,chl, queue, process, agent
  • action: type of action you would like to take for the object:
    • queue manager: save, load, start, stop, list, status,startlistener,startinitiator
    • queue: display, list
    • channel: start, stop, status, reset, resolve, ping, display, list
    • process: display
    • agent: display
  • file.tst is the name of the output or input file. 
    • Generally, you would use the name of the queue manager. You can specify a full path. If the full path contains a space, you must use double quotes (""). 
    • When saving a file, if a full path is not specified, the file is saved to the directory from which the autocmd.pl was run. 
    • When importing from a file, if a full path is not specified, autocmd.pl assumes the file is in the directory from which autocmd.pl was run.
  • secure_username is the name of the user with authority to use the secured Agent. This is needed only if the Agent is secured.
  • secure_password is the password of the user.

Note

If you have a non-zero return code, the code could correlate to a WebSphere MQ return code (e.g., 2058) or could indicate some problem. -1 is a catch-all return code that means that the command was unsuccessful, but the exact reason was not determined.
Was this page helpful? Yes No Submitting... Thank you

Comments