jstatd Command full name: Virtual Machine Jstat Daemon
DESCRIPTION
The jstatd tool is a RMI server application that monitors for the creation and termination of instrumented hots Pot Java Virtual machines (JVMs) and pro-
Vides a interface to allow remote monitoring tools to attach to JVMs running on the local host.
The JSTATD server requires the presence of an RMI registry on the local host. The JSTATD server would 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 are not found, one'll be created within the JSTATD 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 is inhibited by
Specifying THE-NR option.
NOTE - This utility are unsupported and may or may not be available in the future versions of the J2SE SDK. It isn't currently available on the Windows 98
and Windows ME platforms.
JSTATD is an RMI (Remove Method invocation)-based service program that monitors the creation and destruction of resources in a hotspot-based JVM, and provides a remote interface that allows remote monitoring tools to connect to local JVM execution commands.
JSTATD is RMI-based, so the RMI registry must exist on the server running JSTATD, and if you do not specify the port to which you want to connect by using the option "-P port", JSTATD will attempt to connect to the default port of the RMI registry. We'll talk about how to connect to a default RMI internal registry, how to disable the creation of the default RMI internal registry, and how to start an external registry
option parameter:jstatd command line arguments can be in any order, and if there are redundant or conflicting arguments, the last parameter takes precedence.
-NR: When the RMI Registry service is not found, there is no attempt to create a rim registry within JSTATD.
-P: Specifies the registered RMI registry Server port, if no registry service is found on this port and no parameter-NR is specified, registry will be created inside JSTATD with the specified port.
-N rminame: Specifies the name of the remote service object bound to the Rim registry, which defaults to Jstatremotehost, and if multiple JSTATD services are running concurrently on the same host, Rminame can be used to uniquely identify a JSTATD service Here, it is important to note that if this option is turned on, you must specify both HostID and Vmid when monitoring client remote connections, so that you can uniquely determine which service to connect to
-joption: Used to pass the JVM option to the Java loader called by Javac, for example, "-j-xms48m" will set the boot memory to 48M, using the-J option can easily pass parameters to the Java-based development of the underlying virtual machine application.
JSTATD Safety:
if no other security manager is set, JSTATD will use the Rmisecuritypolicy, and you need to specify a security policy file. The security policy file must conform to the security policy syntax, through the command
-j- Djava.security.policy=file Specifies the policy file. A security policy can access all code libraries.
Grant codebase "file:${java.home}/. /lib/tools.jar " {
Permission java.security.AllPermission;
};
Save the above 3 lines of security policy, such as saving the file name as the Statd.all.policy file. You can use the security policy by starting JSTATD with the following command.
jstatd -j-djava.security.policy=jstatd.all.policy
Example:
(1) If no RMI registry is listening on the default 1099 port, the registry RMI Regitry service will be automatically created internally
Jstatd-j-djava.security.policy=all.policy
(2) Use an external RMI registry service that already exists. Open the RMI Registry service first, and then turn on JSTATD.
Rmiregistry 5000
Jstatd-j-djava.security.policy=all.policy-p 5000
At this time with JPS command such as: JPS localhost:5000
(3) Specify Vmid
jstatd -j-djava.security.policy=all.policy - P 2020 - n alternatejstatdservername
Java JSTATD Detailed