Monday, March 10, 2008

A Perl module to access ITM SOAP methods

Sometime back, I posted a blog entry discussing how to access ITM SOAP methods from Java. Expanding on that idea, here is a Perl module to access the ITM SOAP servers using Perl.

Capabilties

Theoretically, you should be able to do most of the tasks that the TEMS SOAP server can do. For example, you can

1) stop and start situations
2) Send a WTO message.
3) Get the list of managed systems and their status
4) Get the list of situations from Situation History table and their status.
5) Invoke CT_* methods to get attributes and manipulate situations.
6) Turn on your microwave

Oops, I did overhype it little bit. :-)

One of the cool thing with Perl XML parser is that you get the output in a Perl data structure and you can examine the status of agents and situations natively in Perl.

For example, the following statement examines if the current managed system is an Online Windows OS agent.

if ($managedSystem->{'Product'} eq 'NT' and $managedSystem->{???????????????Status'}?eq '*ONLINE')
{
# do something.
}


Other SOAP calls are equally easy as well.

# starts the situation
$gbssoap->startSituation("mysituation");

# gets the managed systems
@systems = $gbssoap->getManagedSystems();


The modules

There are two modules involved here. TEMS.pm is the base SOAP abstraction module that supports most of the ITM SOAP methods such as CT_Get, CT_Alert, CT_Activate, etc. You just have to initialize the TEMS object with the hostname of the TEMS server. After that, you can invoke all the CT* methods from the initialized TEMS object.

Sometimes, you may not aware of what CT_* method to invoke and what parameters need to be passed. Here is where the GBSSoap.pm module fits in. It is a wrapper class around the TEMS.pm to provide commonly used functions such as starting/stopping situations, getting a list of managed systems and their status, etc. This module is purely optional and if you know what CT_* method to invoke, you can directly invoke the method on the TEMS object instead of using this wrapper module.

Pre-requisites

Obviously, you need Perl 5.x preferably 5.6 or later. You also need XML::Simple and LWP::UserAgent modules that comes built-in with your Perl distribution.

Installation.

Nothing to install. Just store the Perl modules (.pm files) in your module library (recommended) or in Perl default module directory, which is /site/lib.

How does it work?

Whenever you invoke a CT_* methods on a TEMS object, the method prepares the necessary XML for the SOAP request and issues a HTTP post on the TEMS server. The server processes the SOAP request and returns an XML containing the result of the request. The resulting XML is parsed, filtered and the result is stored in a Perl array of complex type and returned to the caller.

A sample program

You will see a sample perl program (soaptest.pl) that shows how use these modules. The output of the sample program is also attached. (soaptest.out.txt).

Download

This Perl module is available for registered users. Are you a registered user? If so, please contact Tony Delgross by email (tony_delgross@gulfsoft.com) or by phone (919-206-4466). We apologize for the inconvenience. At GulfBreeze, We are fully committed to contributing to Tivoli community and to our customers, but some of our competitors exploit our good intentions deliberately. We are working on making this process as painless as possible for genuine users but please bear with us until then. Thank you very much for your understanding.

Not a registered user? Registration is easy, please click here to signup.

No comments: