Tuesday, March 4, 2008

Executing remote commands in ITM6.x using gbscmd

One of the sorely missed functionality of Tivoli Framework in ITM 6.x is is the remote command execution feature. Framework tasks provided this nice and useful feature, but ITM does not have any such functionality. However, in ITM 6.x, you can get this feature by using SOAP calls, but SOAP calls are not your cup of tea? Don't worry! Gbscmd has a new feature that provides way to execute remote commands using SOAP calls. This article details how to execute remote commands in ITM 6.x.
gbscmd

This article assumes you are already familiar with gbscmd. If NOT, please google search "gbscmd site:gulfsoft.com" for the past articles on gbscmd at our site. It is a Gulf Breeze provided utility that does many things using SOAP calls. Gbscmd works fine where Perl 5.6 or later is available (Windows, Unix, Linux and even on MacOS X as well!).
Remote command execution

Gbscmd v3.3 added a new switch called "command" that accepts a command & name of the managed system (OS agent) as input, executes the command and prints the exit code in standard output. Please note that the command text is limited to 256 characters. This is an ITM size limitation regardless of the OS.

Here is how you would execute a command.

$ gbscmd command --auth --command "/opt/IBM/ITM/bin/cinfo -r > /tmp/cinfo.txt" --managedsystem linux1:LZ
Executing command on linux1:LZ : Return code is 0
$

By default, the command will timeout after 60 seconds, but you can change the timeout value using --timeout switch. For example, the following command cycles the Universal agent running on Primary:ITM61:NT

$ gbscmd command --auth --command 'net stop kumcma_primary && net start kumcma_primary' --managedsystem Primary:ITM61:NT --timeout 120
Executing command on Primary:ITM61:NT : Return code is 0
$

Limitations

Even though, this method provides way to execute commmands on remote systems, the following framework task features are NOT available.

1. There is no way to see the output of the command as the SOAP call doesn't return this information.
2. The command text is limited to 256 characters.
3. The executable must reside on the remote system and be accessible.
Other features

Want to know other features of gbscmd? Please feel free to download the reference manual from here
Acknowledgements

Many thanks to Sergei Rodionov of Axibase for the SOAP call.

Posted by Venkat Saranathan

No comments: