Creating policies

Use the CICS Explorer® to create your policies, so that they are ready for deployment.

About this task

A policy is an XML definition that contains one or more policy rules, and a policy is created in a CICS® Bundle project. When you use the wizard to create a policy in a CICS Bundle project, you can create only one rule; if you want to define more rules, see Adding rules to a policy in a CICS Bundle project in the CICS Explorer product documentation. To view the final policy XML when all the steps are complete, see Policy XML.

All of the steps in this task are completed by using the CICS Explorer. It is assumed that from the CICS Explorer you already have a CICS Management Interface connection into the appropriate CICSplex: DEMOPLEX.

Procedure

  1. Create the CICS Bundle project that will contain the policies. The CICS Bundle project name is Policy_Bundle.
    1. Open the CICS Cloud perspective.
    2. In the Project Explorer view, right-click in the window and click New > Project to open the New Project wizard.
    3. Expand the CICS Resources folder, click CICS Bundle project then click Next.
    4. In the Project Name field, enter Policy_Bundle.
    5. Accept the Bundle Properties defaults. The version number default value is 1.0.0, and the default ID is the same as the project name.
    6. Click Finish to create the project in the Project Explorer.
    You have created the CICS Bundle project Policy_Bundle to contain the policies.
  2. Create a policy that issues a message when any 31-bit task storage usage by a user task exceeds 0 bytes. A threshold of 0 bytes is chosen as it is likely to cause the policy to trigger and issue the DFHMP3001 message, making it easier to test and validate that the deployment and scopes are as expected. The policy is named policy_31bit_storage_message, and the policy rule is named rule_31bit_storage_message.
    1. In the Project Explorer view, right-click the CICS Bundle project folder Policy_Bundle, and then click New > Policy Definition to open the Policy Definition wizard.
    2. In the Name field of the Policy Information section, enter policy_31bit_storage_message.
    3. Optional: Enter a description in the Description field of the Policy Information section.
    4. In the Name field of the policy Rule Information section, enter rule_31bit_storage_message.
    5. Optional: Enter a description in the Description field of the Rule Information section.
    6. From the policy rule Type list, select Storage, and from the Item list, select 31-bit Task storage.
    7. To set the conditions for the policy rule, enter 0 in the Value field, and select bytes from the Unit list.
    8. Leave the action to be taken as the default value Issue message DFHMP3001.
    9. Clear the Open editor check box.
    10. Click Finish to create the policy.
      Tip: If you intend to deploy your policy with an application on a platform, you can optionally add a policy scope to your CICS bundle for this policy, if you want to restrict the scope of the rules to a specific application. For more information, see Policy scopes in the CICS Explorer product documentation and Defining policy scopes in the CICS Explorer product documentation.
    You have created policy policy_31bit_storage_message, which issues message DFHMP3001 when a user task uses more than 0 bytes of 31-bit task storage.
  3. Create a policy that issues a message when any user task CPU time usage exceeds 10 milliseconds. The policy is named policy_CPU_time_message, and the policy rule is named rule_CPU_time_message.
    1. In the Project Explorer view, right-click the CICS Bundle project folder Policy_Bundle, and then click New > Policy Definition to open the Policy Definition wizard.
    2. In the Name field of the Policy Information section, enter policy_CPU_time_message.
    3. Optional: Enter a description in the Description field of the Policy Information section.
    4. In the Name field of the policy Rule Information section enter rule_CPU_time_message.
    5. Optional: Enter a description in the Description field of the Rule Information section.
    6. To set a rule for monitoring CPU time, from the policy rule Type list, select Time, and from the Item list, select CPU time.
    7. To set the conditions for the policy rule, enter 10 in the Value field, and select Milliseconds from the Unit list.
    8. Leave the action to be taken as the default value Issue message DFHMP3001.
      Tip: To emit an event to an EP adapter when the threshold is exceeded, click Emit event to, then enter the name of the EP adapter in the EP Adapter field. Use the CICS Explorer to create and deploy an EP adapter resource in this, or another, CICS bundle.
    9. Clear the Open editor check box.
    10. Click Finish to create the policy.
    You have created policy policy_CPU_time_message, which issues message DFHMP3001 when a user task uses more than 10 milliseconds of CPU time.

Results

You have created two separate policies, each containing a rule. You can deploy the CICS bundle with the two policy files, or you can optionally merge the rules into one policy ready for deployment.

Policy XML

Figure 1. policy_31bit_storage_message XML

<?xml version="1.0" encoding="UTF-8"?>
<policy:policy xmlns:policy="https://www.ibm.com/xmlns/prod/cics/managedplatform/policy" policySchemaRelease="0" policySchemaVersion="1">
  <description></description>
  <userTag></userTag>
  <rule type="storage">
    <name>rule_31bit_storage_message</name>
    <description></description>
    <storageUsedCondition item="Task31" operator="GT" unit="B" value="0"/>
    <action>
      <message/>
    </action>
  </rule>
</policy:policy>
Figure 2. policy_CPU_time_message XML
<?xml version="1.0" encoding="UTF-8"?>
<policy:policy xmlns:policy="https://www.ibm.com/xmlns/prod/cics/managedplatform/policy" policySchemaRelease="0" policySchemaVersion="1">
  <description></description>
  <userTag></userTag>
    <rule type="time">
    <name>rule_CPU_time_message</name>
    <description></description>
    <storageUsedCondition item="cpulimit" operator="GT" unit="M" value="10"/>
    <action>
      <message/>
    </action>
  </rule>
</policy:policy>