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:
To see the metrics for Java Virtual Machine, go to Monitoring:
If Resources appears in the navigation pane, select Resources and then select Java Virtual Machine.
Otherwise, select Dashboards and then select the Java Virtual Machine dashboard from the list.
Configuring Monitoring to monitor Java VMs
After you install the monitoring agent, use the following instructions to configure the JVM plugin on your instances.
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/ && sudo curl -O https://raw.githubusercontent.com/Stackdriver/stackdriver-agent-service-configs/master/etc/collectd.d/jvm-sun-hotspot.conf)
As root, edit the downloaded configuration file and replace
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
For more information on the
GenericJMX plugin used to monitor
the JVM, see Plugin:GenericJMX.
What is monitored
The full list of metrics the JVM plugin monitors is at Agent metrics: jvm.
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.