Using Perl scripts to automate actions
Before you begin
The queue manager must exist and must be running. You cannot create a queue manager using this procedure.
To automate actions
- 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
- Use Windows Scheduler or cron on UNIX to call the Perl script.
- 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.
Tip: For faster searching, add an asterisk to the end of your partial query. Example: cert*