perfagent [ options ]
options
- Command-line options. The options may be in any order. However, in the case of redundant or contradictory options being specified, the last option specified will take precedence.
The perfagent tool is an RMI server application that monitors for the creation and termination of instrumented HotSpot Java Virtual Machines and provides a interface to allow remote monitoring tools to attach to Java Virtual Machines running on the local host.The perfagent server requires the presence of an RMI registry on the local host. The perfagent server will attempt to attach to the RMI registry on the default port, or on the port indicated by the -p port option. If an RMI registry is not found, one will be created within the perfagent application bound to the port indicated by the -p port option or to the default RMI registry port if -p port is omitted. Creation of an internal RMI registry can be inhibited by specifying the -nr option.
The perfagent command supports the following options, which are not committed and are subject to change or removal in a future release.
- -nr
- Do not attempt to create an internal RMI registry within the perfagent process when an existing RMI registry is not found.
- -p port
- The port parameter indicates the port number where the RMI registry is expected to be found, or, if not found, created if -nr is not specified.
- -n rminame
- The rminame parameter indicates the name that the remote RMI Object is bound to in the RMI registry. The default name is HotSpotPerfAgent. If multiple perfagent servers are started on the same host, the name of the exported RMI object for each server can be made unique by by specifying this option. However, doing so will require that the unique server name be included in the monitoring client's vmid string.
The perfagent server requires a security policy file. The policy file must conform to the default policy implementation's Policy File Syntax. The perfagent server expects to find its policy file in the PerfAgent.policy file in the policies directory of the jvmstat installation. Alternatively, a platform specific shell variable named PERFAGENT_POLICY can be set (and exported) to refer to a different policy file.To assist in the configuration of the perfagent policy file, the configurepolicy command is provided to process template files into working policy files based on the installation directory of the jvmstat distribution and other environmental differences. The distribution includes three template files, PerfAgentAll.tmpl, PerfAgeentMinimal.tmpl and PerfAgentTrustedHost.tmpl, that can be used to configure some typical policies.
The perfagent server can only monitor Java Virtual Machines for which it has the appropriate access permissions. However, perfagent does not perform any user level authentication or authorization. Therefore, it opens access to the instrumentation exported by the Java Virtual Machines for which the perfagent server has the appropriate access permissions, allowing arbitrary users on the network to monitor Java Virtual Machines that might otherwise be inaccessible. Such exposure may be unacceptable in your environment. Particular care should be exercised when running the perfagent server with credentials that allow wide exposure, such as running the server with root permissions on UNIX based systems.
The exposure introduced by the perfagent server can be eliminated by not running the server, thus requiring all monitoring activities to be performed locally. Alternatively, the PerfAgent.policy can be customized to limit access to specific, trusted hosts. A future version of the perfagent server may address user level authentication and authorization.
The interface exported by the perfagent process is proprietary and is guaranteed to change. Users and developers are discouraged from writing to this interface at this time.
Here are some examples on starting the perfagent. Note that the perfagent scripts automatically start the server in the background.Simple startup
This example demonstrates how to startup the perfagent with an internal RMI registry. This example assumes that no other server is bound to the default RMI Registry port (port 1099).
% perfagentStartup with separate RMI registry
This example demonstrates how to startup the perfagent process with a external RMI registry.
% rmiregistry& % perfagentStartup with RMI registry on a different port
This example demonstrates how to startup the perfagent process with an external RMI registry server.
% rmiregistry 2020& % perfagent -p 2020Startup with RMI registry on a different port
This example demonstrates how to startup the perfagent process with an external RMI registry .
% rmiregistry 2020& % perfagent -p 2020 -n NonStandardPerfAgentNameStartup, inhibit the creation of an in-process RMI registry
This example demonstrates how to startup the perfagent process such that it will not create a RMI registry if one is not found. This example assumes an RMI registry is already running. If it is not, an appropriate error message is emitted.
% perfagent -nrStartup with an alternative policy file
This example demonstrates how to startup the perfagent process that uses an alternative security policy. This example assumes that the file referred to by the PERFAGENT_POLICY environment variable is a valid policy file. An invalid policy file will likely result in Java Security exceptions that indicate the denied access.
% PERFAGENT_POLICY=/tmp/AlternatePerfAgent.policy % export PERFAGENT_POLICY % perfagent -nrThis example uses the Bourne Shell syntax for setting environment variables, other shells or command interpreters may require different syntax.
Troubleshooting the perfagent server using the RMI logging capabilities.
This example demonstrates how to startup the perfagent process with RMI logging capabilities enabled. This technique is useful as a troubleshooting aid or for monitoring server activities.
% VMARGS="-Djava.rmi.server.logCalls=true % export VMARGS % perfagent % unset VMARGSThis example uses the Bourne Shell syntax for setting environment variables, other shells or command interpreters may require different syntax.
Copyright © 2003 Sun Microsystems, Inc. All Rights Reserved. |
![]() Java Software |