Example: Defining a task rule for user tasks that consume too much CPU
This example shows you how to define a task rule in a CICS® policy by using CICS Explorer®. The rule will emit an event when any user task in
the target region consumes more than 500 milliseconds of CPU.
Procedure
All policies are created in a CICS bundle project, so you
must first create a CICS bundle project. For details, see
Creating a CICS bundle project.
After you have created a CICS bundle project, right-click
the CICS bundle project in the Project
Explorer view and click New > Policy
Definition.
Enter a name for the policy (CICS_policy_example) in the
File name field and click Finish. This opens the
Policy Overview tab of the Policy Definition
editor.
On the Policy Overview tab, click the
New button to the right of the Rules section to open
the New Rule dialog.Figure 3. New Rule
dialog
Define the new rule as follows:
Field
Value
Name
event_if_more_than_500ms_of_CPU
Description (optional)
Emit a CICS event if a task consumes more than 500ms of
CPU
Rule type
Time
Click OK to return to the Policy Definition editor.
You are on the Rules tab by default.Figure 4. Rules
tab
In the Condition section, define the threshold as follows:
Select CPU time from the first drop-down box.
Specify 500 in the input field after greater
than.
Select milliseconds in the second drop-down box.
You can leave the Transaction ID and User ID filters as-is, because this policy is intended
to be region scoped.
In the Action section, define the action of the new rule as follows:
Select Emit an event.
Select EP Adapter from the drop-down box.
Enter CPUMON as the name of the EP adapter.
The EP adapter named here,
CPUMON, can be any of the supported types of EP Adapter. For example, it can be a simple custom
adapter that writes a message to an operator console or a HTTP adapter that routes the event to an
event processing product such as IBM® Business Monitor to
update an operations dashboard. For details on the different types of EP adapter available, see
Event processing adapters in the CICS TS product documentation.
If you are happy with the policy definition, you can deploy the bundle into CICS. When the policy is deployed into a CICS region, the task rule will emit an event when any user tasks in that region consumes more than 500 milliseconds of CPU.