Skip to Content

Implement a Dashboard Application for Monitoring Java Apps

test
0 %
Implement a Dashboard Application for Monitoring Java Apps
Details

Implement a Dashboard Application for Monitoring Java Apps

December 9, 2020
Created by
December 1, 2020
Create an application that retrieves metrics for Java applications running on SAP Cloud Platform.

You will learn

  • How to configure a custom application that retrieves metrics for Java applications running on SAP Cloud Platform
QR code

Prerequisites

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 on SAP Cloud Platform):

  • app1 located in a1 subaccount and Europe (Rot/Germany) region

  • app2 located in a2 subaccount and US East region

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 Cloud Platform Monitoring Response for Java Applications.

To learn more about the whole scenario, read the Dashboard Scenario blog post.


Step 1: Download the project

Download the cloud-metrics-dashboard project as a ZIP file from https://github.com/SAP/cloud-metrics-dashboard.

Log on to answer question
Step 2: Import into Eclipse

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.

How did you import the folder in Eclipse?
×
Step 3: Update Configuration.java

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.

What parameters have you set the values for in the `Configuration.java` class?
×
Step 4: Test your scenario
  1. 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 Cloud Platform cockpit.

  2. Create a Java Web server (for example, Java Web Tomcat 8 server) in Eclipse and start it.

  3. Run your Eclipse project on the server.

  4. Verify the following:

    • Initially, the dashboard displays all the states of the Java applications.

      loio8366cfa2e5264a289241d074dfafb980_LowRes
    • 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.

      loioc3b8419878a148578038cb2035d34eb5_LowRes

      An empty field in the Thresholds column signifies that the warning and critical values are set to zeros.

What have you verified for the dashboard application?
×

Next Steps

Back to top