Table of Contents AboutMonitoring1 Sun ONE Application Server 7 Statistics 2 What Can Be Monitored? 2 Extracting Monitored Information. 3 SNMPMonitoring..3 Quality of Service 4 Setting QoS Parameters.. 5 EnablingQoS5 AboutLogging..6 Loggers and Log Levels.. 7 ComponentLogging..8 Log File Rotation. 8 Configuring Server Logging Preferences 9 Configuring Log File Name and Location. 10 Configuring Log Levels.. 10 Configuring Logging Options.. 10 This module describes the features of Sun ONE Application Server 7 that you can use for monitoring and logging. Objectives Describe Sun ONE Application Server monitoring features Describe the monitorable components Determine the process of extracting monitoring information in Sun ONE Application Server Describe Sun ONE Application Server logging features Explain how to configure logging preferences About Monitoring What is monitoring? In summary, monitoring provides a set of data that can be used to analyze server behavior. Your server s state of activity is measured from statistics that are used to collect information from strategic data points. The statistics show you how many requests your server is handling and how well it is handling those requests. You can view some statistics for individual virtual servers, and others for the entire server instance. Monitoring Sun ONE Application Server 7 As a system administrator, one of the most important tasks that you have to perform is to monitor server performance. Sun ONE Application Sever 7 provides you with data about the server performance such as the number of requests and ability of the server to handle the requests. You use this data to analyze server behavior. In Sun ONE Application Server 7, the monitoring tools report data for application components and subsystems for 1
different data points, such as virtual servers, cache, and connections. The tools also enable monitoring for specific application components. Based on the data reported, you create custom solutions or enable third-party solutions to enhance server performance. Sun ONE Application Server 7 Statistics Sun ONE Application Server provides data monitoring for selected application subsystems. This module describes the persistent statistics collected for the subsystems and how to enable other monitoring capabilities, such as the monitoring of deployed application components. Additionally, the following options for obtaining and listing statistics are described: From the command line interface, asadmin From the Sun ONE Application Server Management Information Base (MIB) With either method of statistics collection, the Sun ONE Application Server s Administration Server instance must be up and running. The asadmin utility connects to the Administration Server in the background to gather the requested information. For SNMP statistics collection using the Sun ONE Application Server MIB, the Administration Server process supports the SNMP software; the Administration Server must be up and running for associated application server instances to provide SNMP monitoring capabilities. What Can Be Monitored? Subsystems The Sun ONE Application Server provides persistent data monitoring from the command line for the following subsystems even when monitoring has not been enabled: Enterprise JavaBeans (EJB) container Web container Transaction Service ORB Service Monitoring of the container subsystems is not enabled by default. To enable monitoring from the Administration Server GUI, you need to go to the container or service node in the left frame to check the box to enable monitoring. SNMP The Sun ONE Application Server MIB enables persistent data monitoring using SNMP for the following information: Server connections Domain Name System (DNS) statistics Keep-alive statistics 2
Virtual server information Extracting Monitored Information You can extract monitored data through the CLI. Two asadmin commands are available for extracting monitored statistics: list --monitor get --monitor Note:Monitoring also has the CLI command set. This command is used to set monitoring statistics for the transaction service only. list --monitor This command provides the following information: Application components and subsystems currently monitored for the specified server instance name. For example: asadmin> list --monitor server1 J2EE applications currently monitored for the specified server instance name For example: asadmin> list --monitor server1.application Attributes within J2EE applications currently monitored for the specified server instance name For example: asadmin> list --monitor server1.application.ejb-module.* get --monitor This command retrieves the following monitored information: Attribute(s) monitored within an application component or subsystem Specific attribute(s) monitored within an application component or subsystem Attribute(s) monitored within a J2EE application When an attribute is requested that does not exist for a particular application component or subsystem, an error is returned. Similarly, when a specific attribute is requested that is not active for a application component or subsystem, an error is returned. SNMP Monitoring 3
An understanding of how the SNMP is used to monitor network servers and devices is a prerequisite to using the Sun ONE Application Server Management Information Base (MIB). SNMP Components The following paragraphs provide a brief description of the required SNMP components. Network Management Station A network management station (NMS) is used to remotely manage network devices, routers, and servers that have SNMP enabled. Generally, the NMS software is equipped to graphically display collected data. SNMP Agents SNMP agents are required for SNMP monitoring. Master Agent The master agent exchanges information between subagents installed on the managed devices and the NMS. For Sun ONE Application Server, the master agent is installed on the Sun ONE Application Server Administration Server instance. Subagent A subagent is installed for each Sun ONE Application instance to report data to the master agent. With the exception of the Sun ONE Application Server Administration Server, which has the master agent, all server instances must have a subagent installed to be monitored. The Sun ONE Application Server MIB The SNMP specification defines the Internet MIB tree into which all SNMP MIBs must fit. The tree structure ensures that all MIBs can be uniquely identified by their own nodes in the tree. The top level tree is divided into four subtrees: directory, mgmt, experimental, and private. The private subtree has an enterprises node. Most vendors design their MIBs for a node under enterprises. The Sun ONE Application Server MIB is located under the enterprises node. The Sun ONE Application Server MIB, appserv.mib, is located in the server_root/lib directory and defines the server s managed objects (the Sun ONE Application Server parameters that can be monitored by agents). Installation Procedures The procedures for SNMP agent installation vary from vendor to vendor. You should follow the installation instructions for your particular management software. You should, however, be logged in as the owner of an instance to install SNMP agents. For example, you should log in as root to install the master agent because the Administration Server is typically installed to run as root. If the Administration Server runs as another user, you should log in as that user to install the master agent. Quality of Service 4
Sun ONE Application Server also provides Quality of Service (QoS) information. This information is used to determine server efficiency during run time with respect to start up time, server traffic and effects of traffic upon bandwidth, analysis of live versus static data, etc. Setting QoS Parameters Enabling QoS Setting QoS Parameters Quality of Service (QoS) refers to the performance limits you can set for the Sun ONE Application Server. For example, you might want to allocate different bandwidth to different server instances depending on which applications are deployed on them. You can limit: The amount of bandwidth The number of connections You can enable these settings for the entire server or for an individual virtual server level. The QoS parameters are applied to the HTTP server subsystem that is responsible for thread allocation for client requests. QoS bandwidth settings are dynamically enforced through the server s bandwidth calculations over a set period of time. Enabling QoS This page describes the requirements for enabling QoS settings for an entire application server instance and enabling QoS settings for an individual virtual server. Enabling QoS for an Application Server Instance To enable QoS for an application server instance, click the HTTP Server node for the server instance in the left frame of the Administration Server GUI. Then click the QOS tab to access the QoS options. You can configure the following: QoS Enabled Check the box to enable QoS. QoS is not enabled by default. QoS Metrics Interval Enter window of time in seconds over which the server s calculations for bandwidth are valid for the server instance. The default setting is 30 seconds. QoS Recompute Time Interval Enter the time in milliseconds (ms) that can elapse between successive bandwidth calculations. The default setting is 100 ms. Bandwidth Limit Enter the bandwidth (bytes/second) allocated to the server instance. Enforce Bandwidth Limit Check the box to direct the server to enforce the bandwidth limit. Connection Limit Enter the maximum number of connections allowed to the server instance. Enforce Connection Limit Check the box to direct the server to enforce the connection limit. 5
Click Save to save to save the changes. You are required to apply the changes to the server. A server restart is required to activate the enforcement of bandwidth or connection limits, but if you are changing other parameters, a server restart is not required. Setting Bandwidth and Connection Limits for a Virtual Server A prerequisite to setting bandwidth and connection limits for a virtual server is that the QoS Enabled, QoS Metrics Interval, and QoS Recompute Time Interval parameters must be set at the HTTP server level. To define bandwidth and connection limits for a virtual server, select the HTTP Server/Virtual Servers/ <virtual_server_name> node under the application server instance. Scroll down to configure the following bandwidth and connection options at the bottom of the right frame: Bandwidth Limit Enter the bandwidth (bytes/second) allocated to the server instance. Enforce Bandwidth Limit Check the box to direct the server to enforce the bandwidth limit. Connection Limit Enter the maximum number of connections allowed to the server instance. Enforce Connection Limit Check the box to direct the server to enforce the connection limit. As in the case for the application server instance, click Save to save to save the changes. You are also required to apply the changes to the server. A server restart is required to activate the enforcement of bandwidth or connection limits, but if you are changing other parameters, a server restart is not required. About Logging One of the tools used by administrators to track application usage and behavior is logging. Logging enables administrators to timely detect and trace problems in an application. Why is Logging important? Logging enhances a developer s productivity when it is used in applications. Logging produces reports suitable for analysis by end users, system administrators, field service engineers, and software development teams. Logs capture information such as security failures, configuration errors, performance bottlenecks, and bugs in the application or platform. Sun ONE Application Server 7 Logging Logging within Sun ONE Application Server uses the classes and interfaces from the standard Java Development Kit (JDK) 1.4 logging. Sun ONE Application Server collects and stores logging information in one central file for efficiency purposes. Logged messages within the file can be sorted and filtered as needed for specific reporting purposes. On both the Solaris and Windows platforms, the log file is called server.log. You can also direct logs to your own specified log file name. It has log levels that can be redefined during server runtime to increase the performance of the system. The two log files maintained by Sun ONE Application Server 7 are server.log log file and access log file 6
Loggers and Log Levels About Loggers Within Sun ONE Application Server logging can be enabled or disabled selectively at the subsystem level. Logging control for each subsystem is specified in the server.xml file, as described in the Sun ONE Configuration File Reference. Each subsystem has its own logger in accord with the requirements of the JDK1.4 logging API. The following table defines the subsystem and the stored location in the server.xml file for each subsystem. The subsystem Default handlers refers to the default logger associated with all server.xml entries that are not associated with a particular subsystem, such as the utility classes. Table 8.1. Subsystems and their Locations in server.xml file Subsystem Location in server.xml Administrative Server <admin-service> EJB Container <ejb-container> Web Container <web-container> MDB Container <mdb-container> Sun ONE Message Queue (JMS service) <jms-service> Security Service <security-service> Java Transaction Service (JTS) <transaction-service> Object Request Broker (ORB) <iiop-service> Default handlers <log-service> Log Levels You can also assign a log level for each Sun ONE Application Server subsystem for which logging is enabled. A log level is useful to streamline the amount of message information that is recorded during runtime. The level is specified in the server.xml file for the intended subsystem. You can specify the log level directly from the Administrator Interface for the selected subsystem, or, you can edit the server.xml file directly to set the desired log level for the selected subsystem. Log levels are configurable through the Administration interface for applicable subsystems and components. The following table defines the log levels, in increasing order of severity, provided for messages in Sun ONE Application Server. These log levels match the requirements of the JDK1.4 logging API specification. In addition, the log levels ALERT and FATAL are unique to Sun ONE Application Server and are not yet supported by the JDK1.4 logging API. Table 8.2. Description of Log Levels Log level Type of messages logged under the log level DEBUG_HIGH, DEBUG_MED, DEBUG Messages that indicate different granularity of the debug. HIGH gives the maximum verbosity with respect to debug. APPLICATION These messages provide information about the execution environment, pertaining to a Servlet or EJB. 7
INFO These messages are informative in nature, usually related to server configuration or server status. These messages do not indicate errors that need immediate action. CONFIG A message that relates to a configuration issue. WARN A message that indicates a warming. The message would probably be accompanied by an exception. ERROR A message that indicates non-fatal errors that warn about unusual behavior within the server. SECURITY A message that provides security related information or warning. ALERT A message which alerts the user to take a specific form of action. FATAL A message which indicates a fatal error, after which server execution is not recommended. Ideally, this would be the last message before a server crash. Component Logging Sun ONE Application Server 7 enables you to log web container, core server, application client, and virtual server. You can use ereport logging to log different components. Logging is enabled on the following components: Web container Core server ereport logging provides a very fast and simple mechanism for logging messages to a variety of output media. Application client At initialization of the application client, a log handler is created and logs messages to the file name specified in the clientcontainer.xml file. Virtual server ereport logging provides logging for virtual servers. Log File Rotation Log file rotation enables you to archive different log files automatically as per your requirements. Sun ONE Application Server 7 enables archiving of log files after a specified time interval. The archived log files are saved with date and time stamp. With Sun ONE Application Server, log files can be automatically archived at a certain time, or after a specified interval. The server saves the old log files and stamps the saved file with a name that includes the date and time at which they were saved. The server offers two types of log rotation for archiving files: Internal-daemon log rotation Scheduler-based log rotation 8
Internal-daemon Log Rotation Internal-daemon log rotation is provided by an HTTP daemon and requires a server restart in order to be activated. You can configure that type of log rotation at the server startup and is limited to the server daemon. Scheduler-based Log Rotation In addition to internal log rotation, you can also use the Scheduler-based log rotation for archiving log files. Scheduler-based log file rotation requires a scheduler restart to beactivated. Parameters for Scheduler-based rotation are stored in the ns-cron.conf file. They can also be specified from the Administration Server GUI. Configuring Server Logging Preferences In Sun ONE Application Server 7, logging is configured using the Administration Server GUI. The configurable options include the following: Name and location of the server.log log file 9
Level of logging Logging options Configuring Log File Name and Location By default, logs are stored in the server.log file located in the <install_dir>/domains/<domain_name>/<instance_name>/logs directory. This file stores all messages from all virtual servers in the Sun ONE Application Server 7 installation. To modify this behavior, administrators need to specify unique filenames for each virtual server that they create. As different virtual servers have unique configurations and host different applications, customizing the log file ensures that each developer reviews information about their own application only. Configuring Log Levels The default log level for Sun ONE Application Server 7 is INFO. This indicates that the log will contain all messages that are marked INFO or lower. Each log level specified ensures messages with all lower levels are stored in the log file. For example, a log file with INFO log level might appear as follows: [18/Jul/2002:13:24:18] SEVERE (3553):RSR5049:Error publishing JDBC connection Pool [18/Jul/2002:13:24:18] INFO (3553):CORE5004:Resource [jcp:mypointbase_connection_pool]. [18/Jul/2002:13:24:27] WARNING ( java.io.ioexception: Invalid indirection to offset Resource Deployed: 3553): 2900 If the configuration was for logging WARNING, the same file would be as follows: [18/Jul/2002:13:24:18] SEVERE publishing JDBC [18/Jul/2002:13:24:27] java.io.ioexception: Invalid ( 3553): connection WARNING indirection RSR5049:Error Pool Resource ( 3553): to offset 2900 Further, if the log was configured for SEVERE, the same log would be: [18/Jul/2002:13:24:18] publishing JDBC SEVERE ( connection 3553): Pool Configuring Logging Options The configurable logging options in Sun ONE Application Server 7 include the following: 10 RSR5049:Error Resource
Log stdout content to event log Selected by default, this option logs all output directed to stdout in the server.log file. This creates a ready list of all output generated by the system and can help in troubleshooting the Sun ONE Application Server. This feature often makes it easier for administrators as well as developers to monitor an application s output. Log stderr content to event log Selected by default, this option logs all error messages reported to stderr in the server.log file. This option results in the inclusion of all errors generated by the system being in the log file. The benefit of using this feature is similar to the logging of stdout messages. Echo to stderr Selected by default, this redirects a copy of all messages in the server.log log to stderr. This enables administrators to view errors and monitor Sun ONE Application Server 7 from the console. This option is equivalent to performing a tail -f command on the server.log file from the console. Log virtual server id Unselected by default, when selected this option adds the name of the virtual server to the log record. This helps administrators track exactly where an error has occurred. Write to system log Unselected by default, when selected this option redirects a copy of the server.log log to the system log. This creates a record of all messages logged by Sun ONE Application Server 7 in a store that can be accessed without accessing the server.log file. Currently, this option does not allow a subset of the server.log file to be redirected; the entire file is redirected. 11