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

  1. 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.
  2. After you have created a CICS bundle project, right-click the CICS bundle project in the Project Explorer view and click New > Policy Definition.
    Figure 1. Creating a new policy definition
    Right-click the bundle and select New, Policy Definition
    The Create Policy Definition dialog opens.
    Figure 2. Create Policy Definition Dialog
    This figure shows the Create Policy Definition dialog

    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.

  3. 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
    This figure shows the New Rule dialog in the Policy Definition editor.
    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
  4. Click OK to return to the Policy Definition editor. You are on the Rules tab by default.
    Figure 4. Rules tab
    This figure shows the Rules tab in the Policy Definition editor.
  5. 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.

  6. 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.

What's next

If you want the rule to apply only to specific user tasks instead of all in the target region, you can build upon this rule by adding either condition filters or policy scopes and entry points. For instructions, see Examples 2 and 3 in Examples: Defining a policy that applies to specific user tasks in a single CICS region.

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.