Chapter 8. Monitoring your application
This section contains information about monitoring your Spring Boot–based application running on OpenShift.
8.1. Accessing JVM metrics for your application on OpenShift Copy linkLink copied to clipboard!
8.1.1. Accessing JVM metrics using Jolokia on OpenShift Copy linkLink copied to clipboard!
Jolokia is a built-in lightweight solution for accessing JMX (Java Management Extension) metrics over HTTP on OpenShift. Jolokia allows you to access CPU, storage, and memory usage data collected by JMX over an HTTP bridge. Jolokia uses a REST interface and JSON-formatted message payloads. It is suitable for monitoring cloud applications thanks to its comparably high speed and low resource requirements.
For Java-based applications, the OpenShift Web console provides the integrated hawt.io console that collects and displays all relevant metrics output by the JVM running your application.
Prerequistes
-
the
oc
client authenticated - a Java-based application container running in a project on OpenShift
- latest JDK 1.8.0 image
Procedure
List the deployment configurations of the pods inside your project and select the one that corresponds to your application.
oc get dc
oc get dc
Copy to Clipboard Copied! Toggle word wrap Toggle overflow NAME REVISION DESIRED CURRENT TRIGGERED BY MY_APP_NAME 2 1 1 config,image(my-app:6) ...
NAME REVISION DESIRED CURRENT TRIGGERED BY MY_APP_NAME 2 1 1 config,image(my-app:6) ...
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Open the YAML deployment template of the pod running your application for editing.
oc edit dc/MY_APP_NAME
oc edit dc/MY_APP_NAME
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Add the following entry to the
ports
section of the template and save your changes:Copy to Clipboard Copied! Toggle word wrap Toggle overflow Redeploy the pod running your application.
oc rollout latest dc/MY_APP_NAME
oc rollout latest dc/MY_APP_NAME
Copy to Clipboard Copied! Toggle word wrap Toggle overflow The pod is redeployed with the updated deployment configuration and exposes the port
8778
.- Log into the OpenShift Web console.
- In the sidebar, navigate to Applications > Pods, and click on the name of the pod running your application.
- In the pod details screen, click Open Java Console to access the hawt.io console.
Additional resources