Visit http://docs.oracle.com/javase/8/docs/technotes/guides/vm/ for more information.
DiscoveryAs you install the JVM plugin on your instances, Stackdriver will populate their respective detail pages with available metrics.
Moving away from jmxtrans
We have deprecated our support for jmxtrans in favor of a collectd plugin called GenericJMX. If you are currently running a VM with the legacy jmxtrans monitoring, you need to upgrade all of the Java-based plugins, namely Cassandra, HBase, Kafka, or Tomcat. After you've upgraded those plugins and restarted the stackdriver-agent service, you can shut down the jmxtrans process. You can then uninstall jmxtrans by removing the /mnt/jmxtrans tree and the /etc/init.d/jmxtrans script (if the script is present).
Configuring Stackdriver to monitor JVM
The JVM plugin requires version 5.5.0-257 or later of the monitoring agent.
Enabling the JVM monitoring plugin
Java Virtual Machines are monitored via JMX.
(cd /opt/stackdriver/collectd/etc/collectd.d/ && curl -O https://raw.githubusercontent.com/Stackdriver/stackdriver-agent-service-configs/master/etc/collectd.d/jvm-sun-hotspot.conf)
Edit the downloaded configuration file and replace
JMX_PORT by the port on which your JVM is configured to allow JMX connections.
After adding the configuration file, restart the monitoring agent by running the following command:
sudo service stackdriver-agent restart
Information on other plugin configuration options can be found at collectd.org.
What is monitored
The JVM plugin monitors the following common JVM metrics:
Active JVM Threads
JVM Heap memory usage
JVM Non-Heap memory usage
JVM Open File Descriptors
JVM Garbage Collection Count