1 .\" Copyright (c) 1994, 2019, Oracle and/or its affiliates. All rights reserved.
   3 .\"
   4 .\" This code is free software; you can redistribute it and/or modify it
   5 .\" under the terms of the GNU General Public License version 2 only, as
   6 .\" published by the Free Software Foundation.
   7 .\"
   8 .\" This code is distributed in the hope that it will be useful, but WITHOUT
   9 .\" ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  10 .\" FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  11 .\" version 2 for more details (a copy is included in the LICENSE file that
  12 .\" accompanied this code).
  13 .\"
  14 .\" You should have received a copy of the GNU General Public License version
  15 .\" 2 along with this work; if not, write to the Free Software Foundation,
  16 .\" Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  17 .\"
  18 .\" Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  19 .\" or visit www.oracle.com if you need additional information or have any
  20 .\" questions.
  21 .\"
  22 .\" Automatically generated by Pandoc 2.3.1
  23 .\"
  24 .TH "JSTATD" "1" "2018" "JDK 13" "JDK Commands"
  25 .hy
  26 .SH NAME
  27 .PP
  28 jstatd \- monitor the creation and termination of instrumented Java
  29 HotSpot VMs
  31 .PP
  32 \f[B]Note:\f[R] This command is experimental\ and unsupported.
  33 .PP
  34 \f[CB]jstatd\f[R] [\f[I]options\f[R]]
  35 .TP
  36 .B \f[I]options\f[R]
  37 This represents the \f[CB]jstatd\f[R] command\-line options.
  38 See \f[B]Options for the jstatd Command\f[R].
  39 .RS
  40 .RE
  42 .PP
  43 The \f[CB]jstatd\f[R] command is an RMI server application that monitors
  44 for the creation and termination of instrumented Java HotSpot VMs and
  45 provides an interface to enable remote monitoring tools, \f[CB]jstat\f[R]
  46 and \f[CB]jps\f[R], to attach to JVMs that are running on the local host
  47 and collect information about the JVM process.
  48 .PP
  49 The \f[CB]jstatd\f[R] server requires an RMI registry on the local host.
  50 The \f[CB]jstatd\f[R] server attempts to attach to the RMI registry on the
  51 default port, or on the port you specify with the \f[CB]\-p\f[R]
  52 \f[CB]port\f[R] option.
  53 If an RMI registry is not found, then one is created within the
  54 \f[CB]jstatd\f[R] application that\[aq]s bound to the port that\[aq]s
  55 indicated by the \f[CB]\-p\f[R] \f[CB]port\f[R] option or to the default RMI
  56 registry port when the \f[CB]\-p\f[R] \f[CB]port\f[R] option is omitted.
  57 You can stop the creation of an internal RMI registry by specifying the
  58 \f[CB]\-nr\f[R] option.
  60 .TP
  61 .B \f[CB]\-nr\f[R]
  62 This option does not attempt to create an internal RMI registry within
  63 the \f[CB]jstatd\f[R] process when an existing RMI registry isn\[aq]t
  64 found.
  65 .RS
  66 .RE
  67 .TP
  68 .B \f[CB]\-p\f[R] \f[I]port\f[R]
  69 This option sets the port number where the RMI registry is expected to
  70 be found, or when not found, created if the \f[CB]\-nr\f[R] option
  71 isn\[aq]t specified.
  72 .RS
  73 .RE
  74 .TP
  75 .B \f[CB]\-n\f[R] \f[I]rminame\f[R]
  76 This option sets the name to which the remote RMI object is bound in the
  77 RMI registry.
  78 The default name is \f[CB]JStatRemoteHost\f[R].
  79 If multiple \f[CB]jstatd\f[R] servers are started on the same host, then
  80 the name of the exported RMI object for each server can be made unique
  81 by specifying this option.
  82 However, doing so requires that the unique server name be included in
  83 the monitoring client\[aq]s \f[CB]hostid\f[R] and \f[CB]vmid\f[R] strings.
  84 .RS
  85 .RE
  86 .TP
  87 .B \f[CB]\-J\f[R]\f[I]option\f[R]
  88 This option passes a Java \f[CB]option\f[R] to the JVM, where the option
  89 is one of those described on the reference page for the Java application
  90 launcher.
  91 For example, \f[CB]\-J\-Xms48m\f[R] sets the startup memory to 48 MB.
  92 See \f[B]java\f[R].
  93 .RS
  94 .RE
  96 .PP
  97 The \f[CB]jstatd\f[R] server can monitor only JVMs for which it has the
  98 appropriate native access permissions.
  99 Therefore, the \f[CB]jstatd\f[R] process must be running with the same
 100 user credentials as the target JVMs.
 101 Some user credentials, such as the root user in Oracle Solaris, Linux,
 102 and OS X operating systems, have permission to access the
 103 instrumentation exported by any JVM on the system.
 104 A \f[CB]jstatd\f[R] process running with such credentials can monitor any
 105 JVM on the system, but introduces additional security concerns.
 106 .PP
 107 The \f[CB]jstatd\f[R] server doesn\[aq]t provide any authentication of
 108 remote clients.
 109 Therefore, running a \f[CB]jstatd\f[R] server process exposes the
 110 instrumentation export by all JVMs for which the \f[CB]jstatd\f[R] process
 111 has access permissions to any user on the network.
 112 This exposure might be undesirable in your environment, and therefore,
 113 local security policies should be considered before you start the
 114 \f[CB]jstatd\f[R] process, particularly in production environments or on
 115 networks that aren\[aq]t secure.
 116 .PP
 117 The \f[CB]jstatd\f[R] server installs an instance of
 118 \f[CB]RMISecurityPolicy\f[R] when no other security manager is installed,
 119 and therefore, requires a security policy file to be specified.
 120 The policy file must conform to Default Policy Implementation and Policy
 121 File Syntax.
 122 .PP
 123 If your security concerns can\[aq]t be addressed with a customized
 124 policy file, then the safest action is to not run the \f[CB]jstatd\f[R]
 125 server and use the \f[CB]jstat\f[R] and \f[CB]jps\f[R] tools locally.
 126 However, when using \f[CB]jps\f[R] to get a list of instrumented JVMs, the
 127 list will not include any JVMs running in docker containers.
 129 .PP
 130 The interface exported by the \f[CB]jstatd\f[R] process is proprietary and
 131 guaranteed to change.
 132 Users and developers are discouraged from writing to this interface.
 134 .PP
 135 The following are examples of the \f[CB]jstatd\f[R] command.
 136 The \f[CB]jstatd\f[R] scripts automatically start the server in the
 137 background.
 139 .PP
 140 This example shows how to start a \f[CB]jstatd\f[R] session with an
 141 internal RMI registry.
 142 This example assumes that no other server is bound to the default RMI
 143 registry port (port \f[CB]1099\f[R]).
 144 .RS
 145 .PP
 146 \f[CB]jstatd\ \-J\-Djava.security.policy=all.policy\f[R]
 147 .RE
 149 .PP
 150 This example starts a \f[CB]jstatd\f[R] session with an external RMI
 151 registry.
 152 .IP
 153 .nf
 154 \f[CB]
 155 rmiregistry&
 156 jstatd\ \-J\-Djava.security.policy=all.policy
 157 \f[R]
 158 .fi
 159 .PP
 160 This example starts a \f[CB]jstatd\f[R] session with an external RMI
 161 registry server on port \f[CB]2020\f[R].
 162 .IP
 163 .nf
 164 \f[CB]
 165 jrmiregistry\ 2020&
 166 jstatd\ \-J\-Djava.security.policy=all.policy\ \-p\ 2020
 167 \f[R]
 168 .fi
 169 .PP
 170 This example starts a \f[CB]jstatd\f[R] session with an external RMI
 171 registry on port 2020 that\[aq]s bound to
 172 \f[CB]AlternateJstatdServerName\f[R].
 173 .IP
 174 .nf
 175 \f[CB]
 176 rmiregistry\ 2020&
 177 jstatd\ \-J\-Djava.security.policy=all.policy\ \-p\ 2020\ \-n\ AlternateJstatdServerName
 178 \f[R]
 179 .fi
 181 .PP
 182 This example starts a \f[CB]jstatd\f[R] session that doesn\[aq]t create an
 183 RMI registry when one isn\[aq]t found.
 184 This example assumes an RMI registry is already running.
 185 If an RMI registry isn\[aq]t running, then an error message is
 186 displayed.
 187 .RS
 188 .PP
 189 \f[CB]jstatd\ \-J\-Djava.security.policy=all.policy\ \-nr\f[R]
 190 .RE
 192 .PP
 193 This example starts a \f[CB]jstatd\f[R] session with RMI logging
 194 capabilities enabled.
 195 This technique is useful as a troubleshooting aid or for monitoring
 196 server activities.
 197 .RS
 198 .PP
 199 \f[CB]jstatd\ \-J\-Djava.security.policy=all.policy\ \-J\-Djava.rmi.server.logCalls=true\f[R]
 200 .RE