9 Configuring Policies and Actions

This chapter describes the Policies and Actions component of the WebLogic Diagnostics Framework (WLDF) that provides the means for monitoring server and application states and then sending actions based on criteria set in the policies. Policies and actions are configured as part of a diagnostic module targeted to one or more server instances in a domain.


As of WebLogic Server 12.2.1, the terms watch and notification are replaced by policy and action, respectively. However, the definition of these terms has not changed.

This chapter includes the following sections:

Policies and Actions

A policy identifies a situation that you want to trap for monitoring or diagnostic purposes. You can configure policies to analyze log records, data events, and harvested metrics.

A policy includes:

  • A policy expression (with the exception of calendar-based policies)

    The default language for policy expressions is the WLDF query language; however, the WLDF query language is deprecated. You can also use Java Expression Language (EL) for policy expressions.

  • An alarm setting

  • One or more action handlers

You can also configure policies to enable elasticity in dynamic clusters; that is, to automatically scale a dynamic cluster up or down by a specific number of server instances. You can define policies to enable two broad categories of elasticity:

  • Calendar-based scaling — Scaling operations on a dynamic cluster that are executed on a particular date and time.

  • Policy-based scaling — Scaling operations on a dynamic cluster that are executed in response to changes in demand.


To configure an elastic scaling policy for a dynamic cluster, you must create a domain-scope diagnostic system module in which you define the scaling policy, and then target that diagnostic module to the Administration Server.

For more information about enabling elasticity in WebLogic Server, including instructions for downloading and running a demonstration example, see Configuring Elasticity in Dynamic Clusters for Oracle WebLogic Server.

An action is an operation that is executed when a policy expression evaluates to true. WLDF supports the following types of actions:

  • Scaling a dynamic cluster

  • Java Management Extensions (JMX)

  • Java Message Service (JMS)

  • Simple Mail Transfer Protocol (SMTP), for example, e-mail

  • Simple Network Management Protocol (SNMP)

  • Diagnostic Images

  • REST

You must associate a policy with an action for a useful diagnostic activity to occur; for example, to notify an administrator about specified states or activities in a running server.

Policies and actions are configured separately from each other. An action can be associated with multiple policies, and a policy can be associated with multiple actions. This provides the flexibility to recombine and re-use policies and actions, according to current needs.

Overview of Policies and Actions Configuration

A complete policy and action configuration includes settings for one or more policies, one or more actions, and any underlying configurations required for the action media; for example, the SNMP configuration required for an SNMP-based action.

The main elements required for configuring policies and actions in a WLDF system resource descriptor file, DIAG_MODULE.xml, are shown in Example 9-1. As the listing shows, the base element for defining policies and actions is <watch-notification>. Policies are defined in <watch> elements, and actions are defined in elements named for each of the types of action; for example, <jms-notification>, <jmx-notification>, <smtp-notification>, and <image-notification>.

Example 9-1 A Skeleton Policy and Action Configuration (in DIAG_MODULE.xml)

<!-- ----- Other system resource configuration elements ----- -->
     <!-- Threshold severity for a log policy to be evaluated further 
           (This can be narrowed further at the policy level.) -->
    <!-- ----- Policy configuration elements: ----- -->
      <!-- A policy expression -->
      <!-- A policy expression -->
    <!-- Any other policy configurations -->

    <!-- ----- Action configuration elements: ----- -->
    <!-- The following action configuration elements show one of each 
         type of supported actions. However, not all types are 
         required in any one system resource configuration, and multiples 
         of any type are permitted. -->
      <!-- Configuration for a JMS-based action; requires a
           corresponding JMS configuration via a jms-server element and a
           jms-system-resource element -->

      <!-- Configuration for a JMX-based action -->
      <!-- Configuration for an SMTP-based action; requires a
           corresponding SMTP configuration via a mail-session element -->
      <!-- Configuration for an SNMP-based action; requires a 
           corresponding SNMP agent configuration via an snmp-agent
           element -->
      <!-- Configuration for an image-based action -->
<!-- ----- Other configuration elements ----- -->


While the notification media must be configured so they can be used by the actions that depend on them, those configurations are not part of the configuration of the diagnostic module itself. That is, they are not configured in the <wldf-resource> element in the diagnostic module's configuration file.

Each policy and action can be individually enabled and disabled by setting <enabled>true</enabled> or <enabled>false</enabled> for the individual policy or action. In addition, the entire policy and action facility can be enabled and disabled by setting <enabled>true</enabled> or <enabled>false</enabled> for all policies and actions. The default value is <enabled>true</enabled>.

The <watch-notification> element contains a <log-watch-severity> sub-element, which affects how actions are executed by log policies.

If the maximum severity level of the log messages that triggered the policy do not at least equal the provided severity level, then the resulting actions are not executed. Note that this only applies to actions executed by log policies. Do not confuse this element with the <severity> element defined on policies. The <severity> element assigns a severity to the policy itself, whereas the <log-watch-severity> element controls which actions are executed by log-type policies.

For information about how to configure policies and actions using the WebLogic Server Administration Console, see "Configure policies and actions" in Oracle WebLogic Server Administration Console Online Help.

Sample Policies and Actions Configuration

A complete configuration for a set of policies and actions in a diagnostic module is shown in Example 9-2. The details of this example are explained in the following topics:

Example 9-2 Sample Policies and Actions Configuration (in DIAG_MODULE.xml)

<?xml version='1.0' encoding='UTF-8'?> 
<wldf-resource xmlns="http://xmlns.oracle.com/weblogic/weblogic-diagnostics" 
  <!-- Instrumentation must be configured and enabled for instrumentation 
       policies -->
      <description>Dye Injection monitor</description> 
      <dye-mask xsi:nil="true"></dye-mask>       <properties>ADDR1=</properties> 
  <!-- Harvesting does not have to be configured and enabled for harvester
       policies. However, configuring the Harvester can provide advantages;
       for example the data will be archived. -->
  <!-- All policies and actions are defined under the 
       watch-notification element -->
    <!-- A harvester policy configuration --> 
      <rule-expression>${com.bea:Name=myserver,Type=ServerRuntime//SocketsOpenedTotalCount} &gt;= 1</rule-expression>
    <!-- An instrumentation policy configuration --> 
      (MONITOR LIKE 'JDBC_After_Execute') AND
      (DOMAIN = 'MedRecDomain') AND
      (SERVER = 'medrec-adminServer') AND
      ((TYPE = 'ThreadDumpAction') OR (TYPE = TraceElapsedTimeAction')) AND
      (SCOPE = 'MedRecEAR')
    <!-- A log policy configuration -->
    <!-- A JMX notification -->
    <!-- Two SMTP actions -->
      <subject>This is a harvester alert</subject> 
      <subject>This is a log alert</subject> 
    <!-- An SNMP notification -->