Until now.
The State based Correlation Engine (SCE) can be run from any of the recent TEC EEIF adapters and in reality the ITM TEC integration is simply a C based event adapter. Using the SCE will allow ITM events to me manipulated and correlated before they are sent to TEC.
Running the SCE from ITM requires a little work. In this example I will use a Linux TEMS and implement the Gulfsoft SCEJavascript custom action to manipulate ITM events using Javascript programs.
First, acquire the JAR files required to run the State based Correlation Engine from a TEC installation. The files needed are:
zce.jar
log.jar
xerces-3.2.1.jar
evd.jar
Also required is the DTD file for your XML rules file. In this case I will use and modify the default XML rules file.
tecroot.xml
tecsce.dtd
Create a directory such as /opt/IBM/ITM/sce and copy the files listed above to this directory.
Since we will be implementing the SCEJavascript custom action we will also need scejavascript.jar and js.jar (included in the Gulfsoft package) both files will also be copied to this directory.
Next we will have to modify the TEMS configuration file to successfully run the SCE. The file is named (on Linux) $CANDLEHOME/config/${HOSTNAME}_ms_${HUB_NAME}.config and contains environment variable settings for the TEMS.
Find the entry for LD_LIBRARY_PATH and add
/opt/IBM/ITM/JRE/li6243/bin:/opt/IBM/ITM/JRE/li6243/bin/classic
to the existing entry. Depending on where ITM is installed and the version of Linux, the path may be different. As you can guess, I will be using the ITM provided Java for this example so there will be no need to download and install another JRE unless you really want to. Also in this file we will setup the initial CLASSPATH environment variable and point it to the minimum required JAR files:
CLASSPATH='/opt/IBM/ITM/sce/zce.jar:/opt/IBM/ITM/sce/log.jar:/opt/IBM/ITM/sce/xerces-3.2.1.jar:/opt/IBM/ITM/sce/evd.jar'
Be sure to add CLASSPATH to the export list.
The next step is to modify the $CANDLEHOME/tables/$HTEMS_NAME/TECLIB/om_tec.config file to enable the SCE:
UseStateCorrelation=YES
StateCorrelationConfigURL=file:///opt/IBM/ITM/sce/tecroot.xml
PREPEND_JVMPATH=/opt/IBM/ITM/JRE/li6243/bin
APPEND_CLASSPATH=/opt/IBM/ITM/sce/js.jar:/opt/IBM/ITM/sce/scejavascript.jar
#TraceFileName=/tmp/eif_sc.trace
#TraceLevel=ALL
Note that we are indicating the location of the ITM provided Java and we are adding the JARs needed to run our custom action.
The next steps are to configure our Javascript code and modify the tecroot.xml file to run the custom action. The Javascript we will use will be a simple change to the msg attribute:
function processEvents(events)
{
for(i=0;i<events.length;i++)
{
var foo="FOO:";
events[i].putItem("msg",foo.concat(events[i].getString("msg")));
}
}
We will call this file test.js and save it in /opt/IBM/ITM/sce.
Finally we will modify the tecroot.xml file to run the custom action:
<?xml version="1.0"?>
<!DOCTYPE rules SYSTEM "tecsce.dtd">
<rules predicateLib="ZCE">
<predicateLib name="ZCE"
class="com.tivoli.zce.predicates.zce.parser.ZCEPredicateBuilder">
<parameter>
<field>defaultType</field>
<value>String</value>
</parameter>
</predicateLib>
<rule id="itm61.test">
<match>
<predicate>true</predicate>
</match>
<action function="SCEJavascript" singleInstance="false">
<parameters><![CDATA[/opt/IBM/ITM/sce/test.js]]></parameters>
</action>
</rule>
</rules>
Once all of the changes have been implemented, stop and start the TEMS.
All of the event that come out of ITM will now have messages starting with "FOO:", check back for more useful examples...