Implement a Dashboard Application for Monitoring Java Apps
Create an application that retrieves metrics for Java applications running in SAP BTP, Neo environment.
Overview
You will learn
- How to configure a custom application that retrieves metrics for Java applications running in the Neo environment.
Prerequisites
Prerequisites
- To test the entire scenario, you need subaccounts in two regions: Europe (Rot/Germany) and US East. For more information, see Regions and Hosts Available for the Neo Environment and SAP BTP Cockpit.
- To retrieve the metrics from Java applications, you need two deployed and running Java applications. For more information, see Java: Application Operations.
- You have installed Maven.
- You have downloaded and set up your Eclipse IDE, SAP BTP Tools for Java, and SDK. For more information, see Setting Up the Development Environment.
Steps
Intro
The application you create shows the states of the Java applications and can also show the state and metrics of the processes running on those applications.
This tutorial uses a Java project published on GitHub. This project contains a dashboard application that requests the metrics of the following Java applications (running in SAP BTP, Neo environment):
app1located ina1subaccount andEurope (Rot/Germany)regionapp2located ina2subaccount andUS Eastregion
After receiving each JSON response, the dashboard application parses the response and retrieves the name and state of each application as well as the name, state, value, thresholds, unit, and timestamp of the metrics for each process. The data is arranged in a list and then shown in the browser as a dashboard.
For more information about the JSON response, see SAP Monitoring Service Response for Java Applications.
To learn more about the whole scenario, read the Dashboard Scenario blog post.
Download the cloud-metrics-dashboard project as a ZIP file from https://github.com/SAP/cloud-metrics-dashboard.
Extract the files into a local folder and import the folder in Eclipse as an existing Maven project.
You can also upload your project by copying the URL from GitHub and pasting it as a Git repository path or URI after you switch to the Git perspective. Remember to switch back to a Java perspective afterward.
In Eclipse, open the Configuration.java class and update the following information:
Your logon credentials
Your Java applications, and their subaccounts and regions (hosts)
private final String user = "my_username";
private final String password = "my_password";
private final List<ApplicationConfiguration> appsList = new ArrayList<ApplicationConfiguration>();
public void configure(){
String landscapeFQDN1 = "api.hana.ondemand.com";
String account1 = "a1";
String application1 = "app1";
ApplicationConfiguration app1Config = new ApplicationConfiguration(application1, account1, landscapeFQDN1);
this.appsList.add(app1Config);
String landscapeFQDN2 = "api.us1.hana.ondemand.com";
String account2 = "a2";
String application2 = "app2";
ApplicationConfiguration app2Config = new ApplicationConfiguration(application2, account2, landscapeFQDN2);
this.appsList.add(app2Config);
}The example shows only two applications, but you can create more and add them to the list.
- Start your Java applications.
You can retrieve metrics only for running Java applications.
> View the status of your Java applications and start them in the SAP BTP cockpit.
Create a Java Web server (for example, Java Web Tomcat 8 server) in Eclipse and start it.
Run your Eclipse project on the server.
Verify the following:
- Initially, the dashboard displays all the states of the Java applications.

- When you select an application, you can view the states of the application's processes.
- When you select a process, you can view the process's metrics.

> An empty field in the *Thresholds* column signifies that the warning and critical values are set to zeros.
Resources
Discussion
Share feedback on this tutorial or join the conversation in SAP Community.