TWS 8.4 Create your own Custom Event

This tip explains how to add a Custom Event and how to trigger it. In the Event rule editor there is one Custom Event called Generic event that comes with the product. We are going to add another event here called Tip event. Open up the event rule editor throught the Dynamic Workload Console to see the Custom event list. Login to the TDWC then open the Tivoli Workload Scheduler > Workload Definition > Event Management and finally click on New Event Rule.

TWSCustomEvent

First export the Generic Event Plugin settings into a file with the xml extension. Login to the MDM and run the following command:

# evtdef dumpdef /tmp/GenericEventPlugIn.xml

Edit the GenericEventPlugIn.xml file.

# vi /tmp/GenericEventPlugIn.xml

Add the following code to the XML file:

,

<event baseAliasName="genericEvt" scope="Generic">
<complexName displayName="Tip event" name="Tip"></complexName>
<displayDescription>The event is sent when the specified expression is matched.</displayDescription>
<property type="string" required="true" wildcardAllowed="true" multipleFilters="true" minlength="1">
<complexName displayName="Tip Parameter" name="TipParam" />
<displayDescription>The value of parameter 1</displayDescription>
</property>
<property type="string" required="true" wildcardAllowed="false" multipleFilters="false" minlength="1">
<complexName displayName="Workstation" name="Workstation" />
<displayDescription>The workstation for which the event is generated.</displayDescription>
</property>
</event>

,

Find </event> and insert the new code after this line. The complete code should look like this:

<?xml version="1.0" encoding="UTF-8"?>
<eventDefinitions

xsi:schemaLocation="http://www.ibm.com/ name="GenericEventPlugIn"></complexName>
<scopes>
<scope name="Generic">
<scopedef text="{Param1} on {Workstation}" />
</scope>
</scopes>
<!-- Generic Event -->
<event baseAliasName="genericEvt" scope="Generic">
<complexName displayName="Generic event" name="Event1"></complexName>
<displayDescription>The event is sent when the specified expression is matched.</displayDescription>
<property type="string" required="true" wildcardAllowed="true" multipleFilters="true" minlength="1">
<complexName displayName="Parameter 1" name="Param1" />
<displayDescription>The value of parameter 1</displayDescription>
</property>
<property type="string" required="true" wildcardAllowed="false" multipleFilters="false" minlength="1">
<complexName displayName="Workstation" name="Workstation" />
<displayDescription>The workstation for which the event is generated.</displayDescription>
</property>
</event>
<event baseAliasName="genericEvt" scope="Generic">
<complexName displayName="Tip event" name="Tip"></complexName>
<displayDescription>The event is sent when the specified expression is matched.</displayDescription>
<property type="string" required="true" wildcardAllowed="true" multipleFilters="true" minlength="1">
<complexName displayName="Tip Parameter" name="TipParam" />
<displayDescription>The value of parameter 1</displayDescription>
</property>
<property type="string" required="true" wildcardAllowed="false" multipleFilters="false" minlength="1">
<complexName displayName="Workstation" name="Workstation" />
<displayDescription>The workstation for which the event is generated.</displayDescription>
</property>
</event>
</eventPlugin>
</eventDefinitions>

,

Save the changes and import the event definition changes.

# evtdef loaddef /tmp/GenericEventPlugIn.xml

Open the Event Rule Editor again and click on Custom Event. There should now be another custom event called Tip Event in the list.

TWSTipEvent

To test this custom event create an event rule with an action to send a message. In the event rule editor name the rule TIPEVENTRULE and select Tip event. A Tip event box appears click on it. Within the Properties window type in * in the Tip paramater field and “MALIN” in the workstation field.

TipEventRule

Add an action to send a message to the message logger. In the properties window add some description for instance “Send message to the message logger”. In the message field enter: Tip event triggered with parameter %{genericEvt1.TipParam}. Select Severity Information and the Object Key TIP.

TipAction

Send an event with the TWS command sendevent.

# sendevent Tip GenericEventPlugIn TipParam="TipMessageLogger" Workstation="MALIN"

Open up Workload Tracking and click on Operator Messages. Select All Operator Messages and OK on the next page. The Tip message is displayed in the table with the TipParam value sent with the sendevent command.

TipMessage