Thursday, February 7, 2019

Monitoring Java Application Running In Cloud Foundry (Platform-as-a-Service)

This article defines the approach to monitor Cloud Foundry Application via any Java Visualization Monitoring tool like JVisualVM or JConsole.

This approach will enable monitoring of Java Virtual Machine utilization (like GC, CPU, Memory etc). Also, it can monitor threads and perform CPU & Memory Profiling.

Step 1: 
Add below parameters in the Cloud Foundry Environment variables for the Cloud Foundry Application to enable Remote JMX monitoring.
JAVA_OPTS: -Djava.rmi.server.hostname=localhost -Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.port=9480 -Dcom.sun.management.jmxremote.rmi.port=9480 -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false
Restage the application to take the above parameters into affect.
    cf restage

Step 2:
Do local port forwarding for your Cloud Foundry application for JMX port running on Cloud Foundry Org/Space.
cf ssh -L 9480:localhost:9480

Step 3:
Use JVisualVM to monitor the Cloud Foundry Application.

CPU/Memory Profiling can also be enabled from JVisualVM          

No comments:

Post a Comment