JSTATD
Section: JDK Commands (1)
Updated: 2023
Index
Return to Main Contents
NAME
jstatd- monitor the creation and termination of instrumented Java
HotSpot VMs
SYNOPSIS
B]Note:R] This command is experimental and unsupported.
V]jstatdR] [I]optionsR]]
- I]optionsR]
-
This represents the V]jstatdR] comman-line options.
See B]Options for the jstatd CommandR].
DESCRIPTION
The V]jstatdR] command is an RMI server application that monitors
for the creation and termination of instrumented Java HotSpot VMs and
provides an interface to enable remote monitoring tools, V]jstatR]
and V]jpsR], to attach to JVMs that are running on the local host
and collect information about the JVM process.
The V]jstatdR] server requires an RMI registry on the local host.
The V]jstatdR] server attempts to attach to the RMI registry on
the default port, or on the port you specify with the V-pR]
V]portR] option.
If an RMI registry is not found, then one is created within the
V]jstatdR] application that[aq]s bound to the port that[aq]s
indicated by the V-pR] V]portR] option or to the default
RMI registry port when the V-pR] V]portR] option is
omitted.
You can stop the creation of an internal RMI registry by specifying the
V-nrR] option.
OPTIONS FOR THE JSTATD COMMAND
- V-nrR]
-
This option does not attempt to create an internal RMI registry within
the V]jstatdR] process when an existing RMI registry isn[aq]t
found.
- V-pR] I]portR]
-
This option sets the port number where the RMI registry is expected to
be found, or when not found, created if the V-nrR] option
isn[aq]t specified.
- V-rR] I]rmiportR]
-
This option sets the port number to which the RMI connector is bound.
If not specified a random available port is used.
- V-nR] I]rminameR]
-
This option sets the name to which the remote RMI object is bound in the
RMI registry.
The default name is V]JStatRemoteHostR].
If multiple V]jstatdR] servers are started on the same host, then
the name of the exported RMI object for each server can be made unique
by specifying this option.
However, doing so requires that the unique server name be included in
the monitoring client[aq]s V]hostidR] and V]vmidR] strings.
- V-JR]I]optionR]
-
This option passes a Java V]optionR] to the JVM, where the option
is one of those described on the reference page for the Java application
launcher.
For example, V--Xms48mR] sets the startup memory to 48 MB.
See B]javaR].
SECURITY
The V]jstatdR] server can monitor only JVMs for which it has the
appropriate native access permissions.
Therefore, the V]jstatdR] process must be running with the same
user credentials as the target JVMs.
Some user credentials, such as the root user in Linux and macOS
operating systems, have permission to access the instrumentation
exported by any JVM on the system.
A V]jstatdR] process running with such credentials can monitor any
JVM on the system, but introduces additional security concerns.
The V]jstatdR] server doesn[aq]t provide any authentication of
remote clients.
Therefore, running a V]jstatdR] server process exposes the
instrumentation export by all JVMs for which the V]jstatdR]
process has access permissions to any user on the network.
This exposure might be undesirable in your environment, and therefore,
local security policies should be considered before you start the
V]jstatdR] process, particularly in production environments or on
networks that aren[aq]t secure.
For security purposes, the V]jstatdR] server uses an RMI
ObjectInputFilter to allow only essential classes to be deserialized.
If your security concerns can[aq]t be addressed, then the safest action
is to not run the V]jstatdR] server and use the V]jstatR]
and V]jpsR] tools locally.
However, when using V]jpsR] to get a list of instrumented JVMs,
the list will not include any JVMs running in docker containers.
REMOTE INTERFACE
The interface exported by the V]jstatdR] process is proprietary
and guaranteed to change.
Users and developers are discouraged from writing to this interface.
EXAMPLES
The following are examples of the V]jstatdR] command.
The V]jstatdR] scripts automatically start the server in the
background.
INTERNAL RMI REGISTRY
This example shows how to start a V]jstatdR] session with an
internal RMI registry.
This example assumes that no other server is bound to the default RMI
registry port (port V]1099R]).
-
V]jstatdR]
EXTERNAL RMI REGISTRY
This example starts a V]jstatdR] session with an external RMI
registry.
-
CB]
rmiregistry&
jstatd
R]
This example starts a V]jstatdR] session with an external RMI
registry server on port V]2020R].
-
CB]
jrmiregistry 2020&
jstatd-p 2020
R]
This example starts a V]jstatdR] session with an external RMI
registry server on port V]2020R] and JMX connector bound to port
V]2021R].
-
CB]
jrmiregistry 2020&
jstatd-p 2020-r 2021
R]
This example starts a V]jstatdR] session with an external RMI
registry on port 2020 that[aq]s bound to
V]AlternateJstatdServerNameR].
-
CB]
rmiregistry 2020&
jstatd-p 2020-n AlternateJstatdServerName
R]
STOP THE CREATION OF AN I-PROCESS RMI REGISTRY
This example starts a V]jstatdR] session that doesn[aq]t create
an RMI registry when one isn[aq]t found.
This example assumes an RMI registry is already running.
If an RMI registry isn[aq]t running, then an error message is
displayed.
-
V]jstatd-nrR]
ENABLE RMI LOGGING
This example starts a V]jstatdR] session with RMI logging
capabilities enabled.
This technique is useful as a troubleshooting aid or for monitoring
server activities.
-
V]jstatd--Djava.rmi.server.logCalls=trueR]
Index
- NAME
-
- SYNOPSIS
-
- DESCRIPTION
-
- OPTIONS FOR THE JSTATD COMMAND
-
- SECURITY
-
- REMOTE INTERFACE
-
- EXAMPLES
-
- INTERNAL RMI REGISTRY
-
- EXTERNAL RMI REGISTRY
-
- STOP THE CREATION OF AN IN-PROCESS RMI REGISTRY
-
- ENABLE RMI LOGGING
-