Stackdriver Monitoring can monitor Java Virtual Machine processes for common Java metrics.
JVM metrics are collected when you configure one or more of the following Java-based plugins with Monitoring:
After you install the monitoring agent and configure one of the Java-based plugins, Monitoring populates the Java Virtual Machine page with inventory and metrics:
Configuring Monitoring to monitor Java VMs
After you install the monitoring agent,
use the following instructions to configure the JVM plugin on your instances.
For instructions on upgrading from the legacy
jmxtrans monitoring, see
Upgrading from jmxtrans below.
The JVM plugin requires version 5.5.0-257 or later of the monitoring agent. To update the agent, see Upgrading the 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
For a list of the metrics monitored by the JVM plugin, see monitored metrics.
Any additional JMX metrics (MBean attributes) must be sent to Stackdriver Monitoring as custom metrics. For more information, see writing custom metrics. Any user-supplied MBeans added to the configuration that are not redirected to custom metrics will be rejected by the API.
Upgrading from jmxtrans
If you are currently running a VM with the legacy
you need to upgrade all of the Java-based plugins, namely
Tomcat. After you've upgraded those plugins
and restarted the
stackdriver-agent service, you can shut down the
process. You can then uninstall
jmxtrans by removing the
tree and the
/etc/init.d/jmxtrans script (if the script is present).