This section contains information about setting administration policies to automate routine administration tasks, configure self-tuning of the application server for diverse runtime conditions and improve availability by preventing failures. This section also contains information on the self-management templates, which are predefined management rules that you can customize.
This section contains the following topics:
Management rules enable you to automate routine administration tasks, configure self-tuning of the application server for diverse runtime condition and improve availability by preventing failures. A management rule contains an action to be taken when a specified event occurs or a set threshold is reached. You can set management rules that can automatically take corrective action, based on events that you specify.
A management rule consists of two parts — event and action:
An event uses the JMX notification mechanism to trigger a predefined action.
An action is triggered when an associated event occurs. An action is an MBean which is a notification listener which implements javax.management.NotificationListener.
For example, an event could be a SEVERE message logged by the EJB logger, and an action could be alerting an administrator with the log message contents. When the event happens, event data is passed as part of userData part of the javax.management.Notification.
The action specified in your rule has to be implemented as a custom 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 GlassFish Enterprise Server v2.1.1 Developer’s Guide.
The Enterprise Server provides some useful events, which you can further extend by writing custom MBeans to emit notifications. Each event can be further customized by changing its properties.
The following event types are available:
Monitor events: Monitors an attribute of an MBean. Monitor events have similar capabilities to javax.management.monitor package capabilities. In addition to monitoring simple attributes, as Java SE 5 javax.management.monitor does, monitor events also support monitoring complex attributes.
Notification events: Notifies of events from a custom MBean. Use these events to write custom events and thus extend the event dictionary. Any MBeans which can emit a notification can be an event.
Lifecycle: Events for sever startup, showdown, and termination.
Log: Events triggered when the specified logger writes a log entry. For example, you could create a management rule to send an alert to an administrator when an EJB container logger logs a SEVERE log entry.
Timer: Events triggered at the specified date and time, at the specified interval, and so on. These events have capabilities similar to the javax.management.timer package.
Trace: Events triggered on Entry and Exit of HTTP/IIOP request methods, EJB methods, and Web methods. For example, you can design a servlet filter used to log interactions with a servlet as a management rule using Web method Entry and Exit events.
Cluster: Events triggered when a cluster or instance starts, stops, or fails. These events use the Group Management System cluster monitoring.
To configure management rules in the Admin Console:
In the developer profile, go to Configuration -> Management Rules
In the cluster and enterprise profiles, go to Configurations -> Configuration -> Management Rules
On this page, check All Rules Enabled to enable management rules globally. If management rules are not enabled globally, none of the management rules are executed.
In addition, to enable a individual management rule, you must enable the rule on this page by clicking the box next to the rule and clicking Enable.
A rule's MBeans must also be enabled on a target. To enable MBeans, go to Custom MBeans -> MBean. On the Edit Custom MBean page, click the Target tab to access the Custom MBean Targets page, where you can enable the MBeans on some or all of the targets.
For details, see the online help.
To create management rules from the command line, use the create-management-rule command. To set properties of the management rules, use the get and set commands. To list and delete management rules, use list-management-rules and delete-management-rule. For more information, see the online help for these commands, or Sun GlassFish Enterprise Server 2.1.1 Reference Manual.