Sun Java System Application Server Platform Edition 9 Administration Guide

Chapter 17 Configuring Management Rules

This section contains information about setting administration policies to automate routine administration tasks, configure self-tuning of the application server for diverse runtime condition and improve availability by preventing failures.

This section contains the following topics:

About Management Rules

Application Server administrators can use the management rules feature to set policies that self-configure and self-tune connection pool or orb thread pool, detect thread or server hangs, manage memory leaks or out of memory errors, and manage disk usage

A management rule consists of two parts — event and action. The rule specifies an action to be taken when a user—defined event occurs.

Event

An event uses the JMX notification mechanism to trigger a user-defined action.

Action

The user-defined action is performed by the custom Mbean associated with the event. The action can include restarting a server instance or increasing resources allocated to the connection pool. The action is triggered when the data associated with the event is sent to the custom Mbean that implements the javax.management.NotificationListener interface.

For example, when a SEVERE message occurs in the EJB logger, the log record will be sent to the action Mbean as a field of javax.management.LogNotification.

The action specified in your rule is executed by an 'action' MBean. Therefore, before configuring a management rule, you should deploy a custom Mbean designed to receive event notifications and take appropriate action. For details on developing a custom Mbean and deploying it, see Chapter 14, Developing Custom MBeans, in Sun Java System Application Server Platform Edition 9 Developer’s Guide.

Admin Console Tasks for Management Rules

ProcedureTo Configure New Management Rule

To set up a new management rule, perform the following steps:

  1. Access the Management Rules page by going to Configurations > Admin Service > Management Rules.

  2. Ensure All Rules is checked.

    This enables Management Rules globally. If this is unchecked none of the management rules will be executed.

  3. Select New.

  4. In the Name field, provide a name for this rule. For example, Rule1.

  5. Check Enabled to activate this rule.

  6. Enter a description that identifies this rule

  7. Select the Event Type from the drop-down list.

    The Event Type specifies the condition to execute the rule. All events are based on the JMX notification mechanism. You can create a custom event by using Mbeans that implement javax.management.NotificationBroadcaster/NotificationEmitter.

    The following event types are available:

    • Monitor events

      To monitor an attribute of an Mbean.

    • Notification events

      Notification events from a custom Mbean.

    • Lifecycle events

      Corresponds to events in the com.sun.appserv.server.LifecycleEvent interface.

  8. Check to enable the event type to be logged.

  9. Set the log level for this management rule.

    The default is INFO.

  10. Select Next to go to the final part of setting your management rule.

    The subsequent administration screens will depend on the type of event you have selected.

ProcedureTo Configure Monitor Properties

Provide the properties of the event type you have selected in the previous page. Monitoring properties include JSR 77 statistics.

  1. Enter the Observed object name of the Mbean you want to monitor.

    Specifies the javax.management.ObjectName of a system Mbean or the name attribute of a custom Mbean.

    The ObjectName is of the form domain:type=impl-class-name,name=BeanName,server=server, where domain is the JMX Domain where the MBean is registered and BeanName is the name of the Mbean object. For example: user:impl-class-name=com.sun.example.mbeans.Memory,name=MemoryMBean,server=server. You can determine the ObjectName of an Mbean from the deployed custom Mbean, and then add “server=server.”

  2. Specify an attribute of the Mbean you want to monitor.

  3. Enter a description for this monitoring rule.

  4. Specify the granularity, in milliseconds, at which data is collected for this attribute.

    The default is 10 seconds.

  5. Specify the monitor type.

    Select from one from the following choices:

    • Counter — If the monitor is of type CountMonitor or the JSR 77 statistic field being monitored is of an integral type containing a count value.

    • Gauge — If the monitor is of type GaugeMonitor or the JSR 77 statistic field being monitored is of an integral type containing a gauge value.

    • String — If the monitor is of type StringMonitor

  6. Specify the action you want performed when the monitored data meets the condition specified in the event type.

  7. Select Finish to save your management rule.

ProcedureTo Configure Notification Properties

You can create a custom event by using Mbeans that implement javax.management.NotificationBroadcaster/NotificationEmitter

  1. Select the deployed custom Mbean from the drop-down list or specify the Object Name of the custom Mbean.

    The Object Name is of the form = domain:type=implementation-class-name,name=implementation-class-name, where domain is the JMX Domain where the MBean is registered.

  2. Specify the notification type.

  3. Enter a description for the event associated with this management rule.

  4. Specify the action you want performed when the monitored data meets the condition specified in the event type.

  5. Select Finish to save your management rule.

ProcedureTo Configure Life Cycle Event Properties

Configure management rule based on Application Server's lifecycle state (ready, shutdown, termination).

  1. Choose the Event that will initiate the action Mbean.

    The choices are : ready, shutdown, termination

  2. Enter a description for the event associated with this management rule.

  3. Specify the action you want performed when the monitored data meets the condition specified in the event type.

  4. Select Finish to save your management rule.

ProcedureTo Configure Log Properties

  1. Select the logging interface.

    Available logging interfaces are displayed in the drop-down box.

  2. Select the log level for the selected logging interface.

  3. Enter a description for the event associated with this management rule.

  4. Specify the action you want performed when the monitored data meets the condition specified in the event type.

  5. Select Finish to save your management rule.

ProcedureTo Configure Timer Event Properties

  1. Specify the date from when this rule is enabled.

  2. Specify the pattern to search for.

    The default pattern is mm/dd/yyyy hh:mm:ss. The pattern must match the format in which you have specified the date.

  3. Specify the time period in milliseconds at which notifications will be sent to the action Mbean.

  4. Specify the number of times the pattern occurs in the notification.

  5. Specify the message that will be written to the log when the pattern occurs.

  6. Enter a description for the event associated with this management rule.

  7. Specify the action you want performed when the monitored data meets the condition specified in the event type.

  8. Select Finish to save your management rule.

ProcedureTo Configure Trace Event Properties

  1. Select the trace points from the drop-down list.

    Notifications from the selected trace points are sent to the action Mbean.

  2. Enter a description for the event associated with this management rule.

  3. Specify the action you want performed when the monitored data meets the condition specified in the event type.

  4. Select Finish to save your management rule.

Equivalent asadmin Command

To configure management rules from the command line, use the create-managemnent-rule command. The command syntax is as follows:

create-management-rule [--terse=false] [--echo=false] [--interactive=true] [--host localhost] [--port 4848|4849 ] [--secure | -s] --user admin_user [--passwordfile filename] [--ruleenabled=true] [--ruledescription description] [--action action-mbean-name] --eventtype log|timer|trace|monitor|cluster|lifecycle|notification [--eventloglevel FINEST|FINER|FINE|CONFIG|INFO|WARNING|SEVERE|OFF] [--recordevent=true] [--eventdescription description] [--eventproperties (property=value[:property=value]*)] [--target target] rule-name

For details on each option, see the man page for create-management-rule at Sun Java System Application Server Platform Edition 9 Reference Manual