# WLOC Administration Console Online Help

# Define constraints

Before you begin

Review Define and assign policies.

As part of a policy, you define constraints (or rules) that govern the performance of services and resources.

To define a constraint:

1. Access the Policies page in one of the following ways:

   - Click the Policies tab in the WLOC navigation bar, click the Definitions tab, and click the Rules tab.

   - Click the Home tab in the WLOC navigation bar and click Rule Definitions under Manage Policies.

   The list of currently defined constraints is displayed in the Rules table.

2. Click Add Policy Definition.
3. Set the fields for the constraint, as required:

   Field | Description
   --- | ---
   Name | Name of the constraint.
   Type | Type of constraint that you want to add. See "Constraint Types" below.

   Constraint Types

   The following sections summarize the types of constraints that can be defined and the additional configuration information that must be specified for each type. The constraint types are defined using the following categories: Deployment, Runtime, and Resource Agreement. Resource agreements define requirements that are evaluated before starting a service or instance, which can occur both at deployment and runtime. When assigning policies to services, you do not bind actions to resource agreement constraints.

   Each constraint that you define is designed to apply in a specific scope: service or process group. You do not explicitly specify the scope when adding constraints. However, you should be careful to match constraints and actions that share the same scope, and that you set the appropriate scope when assigning the policy. The actions that are valid for each type of constraint are provided in each table. For a summary of contraints and actions by scope, see Defining Policies.

   Note: Notification (global) action types can be matched with any type of constraint.

   Deployment Constraints

   The following table summarizes the deployment constraints. The scope and actions that are valid for each constraint are listed. Select one of the following deployment constraints and click Next to configure the additional fields.

   Constraint Type | Event Trigger | Additional Parameters | Scope/Valid Actions
   --- | --- | --- | ---
   Based on deploying a service at a date/time | Specified date and time. The service must be undeployed for the constraint to apply. | Name: Name of the constraint. (You can edit the name that was specified on the previous page.) Policy Priority: Priority of this constraint over other constraints. The higher the number, the higher the priority. Service State: State in which the service should be for the constraint to apply. This value can be set only to undeployed. Day of Week: Day of the week to trigger the action. Month: Month to trigger the action. Day of Month: Day of month to trigger action. Hour: Hour to trigger action. Minute: Minute to trigger action. Second: Second to trigger action. Advanced Cron Job: Valid cron expression to be used in place of the calendar-based parameters above. | Scope: Service Valid Actions: N/A. WLOC deploys the service. You do not assign an action.
   Based on undeploying a service at a date/time | Specified date and time. The service must be deployed for the constraint to apply. | Name: Name of the constraint. (You can edit the name that was specified on the previous page.) Policy Priority: Priority of this constraint over other constraints. The higher the number, the higher the priority. Service State: State in which the service should be for the constraint to apply. This value can be set only to deployed. Day of Week: Day of the week to trigger the action. Month: Month to trigger the action. Day of Month: Day of month to trigger action. Hour: Hour to trigger action. Minute: Minute to trigger action. Second: Second to trigger action. Advanced Cron Job: Valid cron expression to be used in place of the calendar-based parameters above. | Scope: Service Valid Actions: N/A. WLOC undeploys the service. You do not assign an action.
   Based on a service deployment state | Deployment state of a service. | Name: Name of the constraint. (You can edit the name that was specified on the previous page.) Policy Priority: Priority of this constraint over other constraints. The higher the number, the higher the priority. Evaluation Period: Interval of time (in milliseconds) to wait before re-evaluating the constraint. Service State: State in which the service should be for the constraint to apply. Valid options include: starting, stopping, staging, and deploying. This value should correlate with the action to which you bind it. For example: StageServiceAction --> staging StartServiceAction --> starting StopServiceAction --> stopping DestroyServiceAction --> destroying | Scope: Service Valid Actions: StageServiceAction StartServiceAction StopServiceAction DestroyServiceAction Any notification (global) action type

   Runtime Constraints

   The following table summarizes the runtime constraints. The scope and actions that are valid for each constraint are listed. Select one of the following runtime constraints and click Next to configure the additional fields.

   Constraint Type | Event Trigger | Additional Parameters | Valid Actions
   --- | --- | --- | ---
   Based on the value of an attribute or function | Value of a Managed Bean (MBean) attribute. | Name: Name of the constraint. (You can edit the name that was specified on the previous screen.) Priority: Priority of this constraint over other constraints. The higher the number, the higher the priority. Instance Name: Name of the MBean. For example, `com.bea:Name=examplesServer,ServerRuntime=examplesServer` Note: Click Browse to browse to the MBean attribute and set the Instance Name, Instance Type, and Attribute fields. Click Define Custom to create a custom metric. For more information, see Define custom metrics. Instance Type: Type of the MBean. For example, `weblogic.management.runtime.ServerRuntimeMBean`. Attribute: Name of the attribute to evaluate. For example, `State`. Attribute Type: Type of the attribute. Valid values include: Integer, Long, Float, Double, Boolean, Date, and String. Operator: Operator to use for comparison. Valid values include: Minimum, Maximum, Equals, and Matches. The Matches operator can be used with String values only. Only evaluate if available: Flag that specifies that the constraint should be evaluated only if the attribute value is available. Evaluation Period: Interval of time (in milliseconds) to wait before re-evaluating the constraint. Service State: State in which the service should be for the constraint to apply. Valid options include: deployed and undeployed. | Scope: Process Group Valid Actions: Any action with process group or global (Notification) scope
   Based on firing a service event at a date/time | Specified date and time. The service must be in the specified state for the constraint to apply. | Name: Name of the constraint. (You can edit the name that was specified on the previous screen.) Policy Priority: Priority of this constraint over other constraints. The higher the number, the higher the priority. Service State: State in which the service should be for the constraint to apply. Valid options include: deployed, undeployed, and staged. Day of Week: Day of the week to trigger the action. Month: Month to trigger the action. Day of Month: Day of month to trigger action. Hour: Hour to trigger action. Minute: Minute to trigger action. Second: Second to trigger action. Advanced Cron Job: Valid cron expression to be used in place of the calendar-based parameters above. | Scope: Service Valid Actions: Any action with service or global (Notification) scope
   Based on firing a process group event at a date/time | Specified date and time. The service must be in the specified state for the constraint to apply. | Name: Name of the constraint. (You can edit the name that was specified on the previous screen.) Policy Priority: Priority of this constraint over other constraints. The higher the number, the higher the priority. Evaluation Period: Interval of time (in milliseconds) to wait before re-evaluating the constraint. Service State: State in which the service should be for the constraint to apply. Valid options include: deployed and undeployed. Day of Week: Day of the week to trigger the action. Month: Month to trigger the action. Day of Month: Day of month to trigger action. Hour: Hour to trigger action. Minute: Minute to trigger action. Second: Second to trigger action. Advanced Cron Job: Valid cron expression to be used in place of the calendar-based parameters above. | Scope: Service Valid Actions: Any action with process group or global (Notification) scope
   Based on firing a process group event based on the outcome of an action | Success or failure of another action. | Name: Name of the constraint. (You can edit the name that was specified on the previous page.) Priority: Priority of this constraint over other constraints. The higher the number, the higher the priority. Evaluation Period: Interval of time (in milliseconds) to wait before re-evaluating the constraint. Service State: State in which the service should be for the constraint to apply. Valid options include: deployed and undeployed. Action Name: Name of the action that triggers the process group event. Action Status: Action status required to trigger the process group event. Valid options include: succeeded and failed. | Scope: Process Group Valid Actions: Any action with process group or global (Notification) scope
   Based on firing a process group event based on the outcome of another event | Success or failure of the actions that are triggered by the specified constraint. | Name: Name of the constraint. (You can edit the name that was specified on the previous page.) Priority: Priority of this constraint over other constraints. The higher the number, the higher the priority. Evaluation Period: Interval of time (in milliseconds) to wait before re-evaluating the constraint. Service State: State in which the service should be for the constraint to apply. Valid options include: deployed and undeployed. Event Name: Name of the constraint that triggers the process group event. Select an event from the drop-down list. Event Status: Event status required to trigger the process group event. Valid options include: succeeded and failed. | Scope: Process Group Valid Actions: Any action with process group or global (Notification) scope
   Based on a named attribute | Value of an attribute. | For more information about using this constraint, see Define constraints using named constraints (Smart Pack). | Scope: Process Group Valid Actions: Any action with process group or global (Notification) scope

   Resource Agreement Constraints

   The following table summarizes the resource agreement constraints that are valid at deployment and runtime. Select one of the following constraints and click Next to configure the additional fields.

   Note: When assigning policies to services, you do not bind resource agreement constraints to actions.

   Constraint Type | Event Trigger | Additional Parameters | Scope/Valid Actions
   --- | --- | --- | ---
   Based on a minimum amount of CPU | Minimum CPU capacity threshold. | Name: Name of the constraint. (You can edit the name that was specified on the previous page.) Priority: Priority of this constraint over other constraints. The higher the number, the higher the priority. Evaluation Period: Interval of time (in milliseconds) to wait before re-evaluating the constraint. Service State: State in which the service should be in order for the constraint to apply. This option can be set only to deployed. Amount: Threshold value. | Scope: Process Group Valid Actions: None.
   Based on a maximum amount of CPU | Maximum CPU capacity threshold. | Name: Name of the constraint. (You can edit the name that was specified on the previous page.) Policy Priority: Priority of this constraint over other constraints. The higher the number, the higher the priority. Evaluation Period: Interval of time (in milliseconds) to wait before re-evaluating the constraint. Service State: State in which the service should be in order for the constraint to apply. This option can be set only to deployed. Amount: Threshold value. | Scope: Process Group Valid Actions: None.
   Based on a share of CPU | CPU share threshold. | Name: Name of the constraint. (You can edit the name that was specified on the previous page.) Priority: Priority of this constraint over other constraints. The higher the number, the higher the priority. Evaluation Period: Interval of time (in milliseconds) to wait before re-evaluating the constraint. Service State: State in which the service should be for the constraint to apply. This option can be set only to deployed. Amount: Threshold value. | Scope: Process Group Valid Actions: None.
   Based on a minimum amount of memory | Minimum memory threshold. | Name: Name of the constraint. (You can edit the name that was specified on the previous page.) Priority: Priority of this constraint over other constraints. The higher the number, the higher the priority. Evaluation Period: Interval of time (in milliseconds) to wait before re-evaluating the constraint. Service State: State in which the service should be for the constraint to apply. This option can be set only to deployed. Amount: Threshold value. | Scope: Process Group Valid Actions: None.
   Based on a maximum amount of memory | Maximum memory threshold. | Name: Name of the constraint. (You can edit the name that was specified on the previous page.) Priority: Priority of this constraint over other constraints. The higher the number, the higher the priority. Evaluation Period: Interval of time (in milliseconds) to wait before re-evaluating the constraint. Service State: State in which the service should be for the constraint to apply. This value can be set to deployed. Amount: Threshold value. | Scope: Process Group Valid Actions: None.
   Based on a share of memory | Memory share threshold. | Name: Name of the constraint. (You can edit the name that was specified on the previous page.) Priority: Priority of this constraint over other constraints. The higher the number, the higher the priority. Evaluation Period: Interval of time (in milliseconds) to wait before re-evaluating the constraint. Service State: State in which the service should be for the constraint to apply. This value can be set to deployed. Amount: Threshold value. | Scope: Process Group Valid Actions: None.
   Based on minimum number of processes | Minimum number of processes threshold. | Name: Name of the constraint. (You can edit the name that was specified on the previous page.) Priority: Priority of this constraint over other constraints. The higher the number, the higher the priority. Evaluation Period: Interval of time (in milliseconds) to wait before re-evaluating the constraint. Service State: State in which the service should be in order for the constraint to apply. This value can be set to deployed. Amount: Threshold value. | Scope: Process Group Valid Actions: None.
   Based on maximum number of processes | Maximum number of processes threshold. | Name: Name of the constraint. (You can edit the name that was specified on the previous page.) Policy Priority: Priority of this constraint over other constraints. The higher the number, the higher the priority. Evaluation Period: Interval of time (in milliseconds) to wait before re-evaluating the constraint. Service State: State in which the service should be for the constraint to apply. This value can be set to deployed. Amount: Threshold value. | Scope: Process Group Valid Actions: None.
   Based on software availability | Availability of software. This constraint is valid only for plain Agents or ESX Agents that use LVM 1.1 or above. | Name: Name of the constraint. (You can edit the name that was specified on the previous page.) Priority: Priority of this constraint over other constraints. The higher the number, the higher the priority. Evaluation Period: Interval of time (in milliseconds) to wait before re-evaluating the constraint. Software Name: Name of the software. Software Mount Point: Mount point for the software. Service State: State in which the service should be for the constraint to apply. This value can be set to deployed. The file copy assistant, described below, is available only when modifying the constraint, as described in Modify constraints. Copy Files: (Valid for LVM 1.1 only.) Click New to specify a file to be copied to the LVM local disk. You must specify the following parameters: Copy Type: When to perform the copy operation. Valid options include: At Create or At Shutdown. From: Location from which to copy the file. To: Location on the local disk to which to copy the file. Click Save to save the copy operation. The following confirmation message is displayed:
       New Policy File copy created.
   To delete a copy operation, select the check box next to each operation that you want to delete and click Delete. | Scope: Process Group Valid Actions: None.
   Based on IP Address | Availability of an IP address. | Name: Name of the constraint. (You can edit the name that was specified on the previous page.) Policy Priority: Priority of this constraint over other constraints. The higher the number, the higher the priority. Evaluation Period: Interval of time (in milliseconds) to wait before re-evaluating the constraint. IP Address: IP address required. Service State: State in which the service should be for the constraint to apply. This value can be set to deployed. | Scope: Process Group Valid Actions: None.
   Based on ISO software availability | Availability of an ISO image. This constraint is valid for ESX Agents that use LVM only. | Name: Name of the constraint. (You can edit the name that was specified on the previous page.) Priority: Priority of this constraint over other constraints. The higher the number, the higher the priority. Evaluation Period: Interval of time (in milliseconds) to wait before re-evaluating the constraint. ISO Name: Name of the ISO image. Service State: State in which the service should be for the constraint to apply. This value can be set to deployed. The file copy assistant, described below, is available only when modifying the constraint, as described in Modify constraints. Copy Files: (Valid for LVM 1.1 only.) Click New to specify a file to be copied to the LVM local disk. You must specify the following parameters: Copy Type: When to perform the copy operation. Valid options include: At Create or At Shutdown. From: Location from which to copy the file. To: Location on the local disk to which to copy the file. Click Save to save the copy operation. The following confirmation message is displayed:
       New Policy File copy created.
   To delete a copy operation, select the check box next to each operation that you want to delete and click Delete. | Scope: Process Group Valid Actions: None.
   Based on amount of Local Disk Size required | Amount of local disk size required. This constraint is valid for LVM only. | Name: Name of the constraint. (You can edit the name that was specified on the previous page.) Priority: Priority of this constraint over other constraints. The higher the number, the higher the priority. Evaluation Period: Interval of time (in milliseconds) to wait before re-evaluating the constraint. Service State: State in which the service should be for the constraint to apply. This value can be set to deployed. Amount: Threshold value. | Scope: Process Group Valid Actions: None.

4. Click Finish.

   The constraint is added and the following confirmation message is displayed:

       New policy created successfully

After you finish

- Create actions and set up action pipelines to run when policy rules are violated, as described in Define actions and Define action pipelines.

- Modify constraints.