How to remotely monitor Java applications deployed on Tanzu Application Service for VMs with Java Management Extensions
search cancel

How to remotely monitor Java applications deployed on Tanzu Application Service for VMs with Java Management Extensions

book

Article ID: 298459

calendar_today

Updated On:

Products

VMware Tanzu Application Service for VMs

Issue/Introduction

This article applies to Tanzu Application Service for VMs (TAS for VMs) and provides instructions to enable Java Management Extensions (JMX) for Java applications running on TAS for VMs.

Environment

Product Version: Other

Resolution

1. Enable the JBP_CONFIG_JMX environment variable. This can be done by either:

  • Editing application manifest, manifest.yml.
  • Running the `cf set-env` command. 
This article focuses on how to edit the application manifest to enable the JBP_CONFIG_JMX environment variable.
---
applications:
- name: <APP_NAME>
 memory: 512M
 instances: 1
 path: path/java-app.war
 env:
   JBP_CONFIG_JMX: '{enabled: true}'


2. Use "cf push" to deploy the Java application to TAS for VMs.

3. Setup an SSH tunnel for JMX with command:

cf ssh -N -T -L 5000:localhost:5000 <APP_NAME>


Once the SSH tunnel has been created, JConsole should connect to localhost:5000 for JMX access. 
 KB_000003606.jpg

Note: These instructions are only useful in Diego-based containers with SSH access enabled. Diego was introduced in TAS for VMs v1.6.x and is mandatory in TAS for VMs v1.7.x. Additionally, the remote monitoring or debugging feature is only available in Java Buildpack v3.4+.


Additional Information

The instructions are only useful in Diego-based containers with SSH access enabled. Diego was introduced in Pivotal CF v1.6.x and turns to be mandatory in v1.7.x. Additionally, the remote monitoring/debugging feature is only available in Java Buildpack v3.4+.

PCF is not a development platform; you can use it, but it is going to be slow. Users should develop software locally and treat PCF like a deployment target. PCF Dev is provided to set up a compact PCF on a local machine for development/debugging use.