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
To Configure New Management Rule
To set up a new management rule, perform the following steps:
-
Access the Management Rules page by going to Configurations >
Admin Service > Management Rules.
-
Ensure All Rules is checked.
This enables Management
Rules globally. If this is unchecked none of the management rules will be
executed.
-
Select New.
-
In the Name field, provide a name for this rule. For example, Rule1.
-
Check Enabled to activate this rule.
-
Enter a description that identifies this rule
-
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.
-
Check to enable the event type to be logged.
-
Set the log level for this management rule.
The default
is INFO.
-
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.
To Configure Monitor Properties
Provide the properties of the event type you have selected in the previous
page. Monitoring properties include JSR 77 statistics.
-
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.”
-
Specify an attribute of the Mbean you want to monitor.
-
Enter a description for this monitoring rule.
-
Specify the granularity, in milliseconds, at which data is collected
for this attribute.
The default is 10 seconds.
-
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
-
Specify the action you want performed when the monitored data
meets the condition specified in the event type.
-
Select Finish to save your management rule.
To Configure Notification Properties
You can create a custom event by using Mbeans that implement javax.management.NotificationBroadcaster/NotificationEmitter
-
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.
-
Specify the notification type.
-
Enter a description for the event associated with this management
rule.
-
Specify the action you want performed when the monitored data
meets the condition specified in the event type.
-
Select Finish to save your management rule.
To Configure Life Cycle Event Properties
Configure management rule based on Application Server's lifecycle state
(ready, shutdown, termination).
-
Choose the Event that will initiate the action Mbean.
The
choices are : ready, shutdown, termination
-
Enter a description for the event associated with this management
rule.
-
Specify the action you want performed when the monitored data
meets the condition specified in the event type.
-
Select Finish to save your management rule.
To Configure Log Properties
-
Select the logging interface.
Available logging interfaces
are displayed in the drop-down box.
-
Select the log level for the selected logging interface.
-
Enter a description for the event associated with this management
rule.
-
Specify the action you want performed when the monitored data
meets the condition specified in the event type.
-
Select Finish to save your management rule.
To Configure Timer Event Properties
-
Specify the date from when this rule is enabled.
-
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.
-
Specify the time period in milliseconds at which notifications
will be sent to the action Mbean.
-
Specify the number of times the pattern occurs in the notification.
-
Specify the message that will be written to the log when the pattern
occurs.
-
Enter a description for the event associated with this management
rule.
-
Specify the action you want performed when the monitored data
meets the condition specified in the event type.
-
Select Finish to save your management rule.
To Configure Trace Event Properties
-
Select the trace points from the drop-down list.
Notifications
from the selected trace points are sent to the action Mbean.
-
Enter a description for the event associated with this management
rule.
-
Specify the action you want performed when the monitored data
meets the condition specified in the event type.
-
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