Skip to Content

Tutorial: Implementing a Dashboard Application

This tutorial describes the configuration of a custom application that retrieves the metrics of Java applications running on SAP HANA Cloud Platform. Consequently, the implemented dashboard displays the states of the Java applications and can display the state and metrics of the processes running on those applications.

Prerequisites

  • To test the whole scenario, you need accounts on SAP HANA Cloud Platform in two data centers (EU and US East).
  • To retrieve the metrics of Java applications as shown in this scenario, you need two deployed and running Java applications.

Context

This tutorial uses a Java project published on GitHub. This project contains a notification application that requests the metrics of the following Java applications (running on SAP HANA Cloud Platform):

  • app1 located in a1 account and EU data center
  • app2 located in a2 account and US East data center

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. All these data are arranged in a list and then displayed in the browser as a dashboard.

Procedure

  1. Download the cloud-metrics-dashboard project as a ZIP file from https://github.com/SAP/cloud-metrics-dashboard.
  2. Extract the files into a local folder and import the folder in Eclipse as an existing Maven project.

    Note: 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.

  3. Open the Configuration.java class in Eclipse and update the following information: your logon credentials, your Java applications and their accounts and data centers (landscape 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);

            }

            Note: This example shows only two applications, but you can create more and add them to the list.

4. Test your scenario

      1. If necessary, start your Java applications.

        You can retrieve metrics of only running Java applications.

        Recommendation: View the status of your Java applications and start them in the SAP HANA Cloud Platform cockpit.

      2. Create a Java Web server in Eclipse and start it.

        For more information, see Testing and publishing on your server.

      3. Run your Eclipse project on the server.
      4. 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.

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

More Information