This is a doc describing how to display the JMX MBean information from Pivotal Cloud Foundry Ops Metrics through Visual VM. It's mostly complete, but could use a little bit of cleanup.
Pivotal Ops Metrics is a feature of Pivotal Cloud Foundry that collects and exposes system performance information via JMX. That's good as far as it goes, but in and of itself, Ops Metrics does not include a user interface, scripting API, or other means to sample the data. Doing so requires a JMX client to read the provided MBeans. This paper explains how to use two popular GUI JMX client applications, Visual VM, and Oracle JRockit Mission Control, to view the information provided by Pivotal Ops Metrics.
Obviously, you will need to have deployed and configured Ops Metrics on the Pivotal Cloud Foundry foundation you are planning to monitor. Documentation of that procedure can be found at https://docs.pivotal.io/jmx-bridge/installing.html.
IP address of the system where Ops Metrics is running. You can get this from the "Health Manager" field on the Settings tab for Ops Manager.
JMX provider name and password, found on the Credentials tab of the Ops Metric configuration in Ops Manager.
IP address and user login for Ops Manager. Because the Ops Metrics virtual machine is on the internal Cloud Foundry network, it is unlikely you will have direct network access to it. So we will need to tunnel connections through a system we do have connectivity with, Ops Manager.
You will need a ssh client with which to create a tunnel: the ssh command on Linux and Mac, putty on Windows.
Finally, you need a JMX client program to connect to the JMX server and query its MBeans. This document specifically covers Visual VM http://visualvm.java.net/, and Oracle JRockit Mission Control http://www.oracle.com/technetwork/middleware/jrockit/overview/index-090630.html. In the case of Visual VM, you need to have installed the MBean plugin. The jconsole program that comes with the Java SDK will also work. For jconsole, the procedure for connecting is the same as that for JRockit Mission Control.
Start by creating the network "tunnel" that will carry traffic between your system and the JMX server on the Ops Metrics system. (The port chosen here, 61444, is arbitrary.)
% ssh -D 61444 firstname.lastname@example.org
When prompted enter the password. Then start up Visual VM.
You need to configure Visual VM such that it will connect through the SOCKS proxy you configured with ssh. Bring up Visual VM Preferences, and select the Network tab.
Select Manual proxy settings and enter 'localhost' or '127.0.0.1' for SOCKS Proxy, and '61444' for its port.
Click OK to save the settings.
Now, connect to the JMX server. Either click on the +JMX button in the toolbar or right click "Local" and select the "Add JMX Connection..." menu choice.
Then click "OK" to initiate the connection. The display shows a summary for the Ops Metrics JVM.
The information of interest is under the MBeans tab. Select that tab to view the MBean hierarchy.
From here you can explore the various MBeans provided by Ops Metrics. Under the cf-numeric-id node, there is a subnode for each VM that makes up the Cloud Foundry system. Each of those subnodes provides generic metrics for the underlying VM, like cpu usage and percentage disk free.
You can view the same metrics for VMs that provide the various Cloud Foundry services (MySQL, PHD, Redis). Expanding the untitled_dev node displays a functional hierarchy of Cloud Foundry, that can be drilled into to display metrics specific to the function of that node.
For instance, under Router you can see the total number of requests made, as well as the number of requests for each Cloud Foundry component, categorized by the HTTP response code the requests generated.
From here, you can browse amongst the various nodes to see the types of metrics provided.
Next, we discuss how to connect to Pivotal Ops Metrics using Oracle JRockit Mission Control. One advantage of Mission Control over Visual VM is that one can graph the value of a numeric metric over time, and collect these graphs into a dashboard.
Oracle JRockit Mission Control is a tool for monitoring Java program performance that also allows accessing MBeans provided by the program being monitored. You can view documentation and links for downloading the Mission Control tool at http://www.oracle.com/technetwork/middleware/jrockit/overview/index-090630.html.
JRockit Mission Control runs on Windows, so you will need to setup a proxy with putty. First, configure the username and host to connect to.
Under "ssh->Tunnels" in the configuration tree, create a Dynamic port 61444.
Click Add to add the tunnel.
Because Mission Control does not have an application-specific proxy preference, you will need to use Java runtime options so that network connections are made via the proxy setup in Putty. Once putty is up and the socks proxy established, run Mission Control with the command
jrmc -J-DsocksProxyHost=localhost -J-DsocksProxyPort=61444