SAP Home Learn Build Integrate Model Operate Extend with AI ConnectTutorial navigator Knowledge Graph API Devtoberfest Developer Advocates App Space

Manage my Account SAP Devs YouTube ↗ Learnings ↗ Community ↗ Provide Feedback ↗
Logout
โคข Open full site

Implement a Notification Application for Monitoring Java Apps

Create an application that notifies you of critical metrics via e-mail or SMS, using SAP Monitoring service.

Overview

🎓 beginner 30 min. SAP Business Technology PlatformBeginnerJava

You will learn

  • โœ”How to configure a custom application to notify you of critical metrics of Java applications via e-mail or SMS.
  • โœ”How to use the custom application to take self-healing actions by restarting the specified Java applications running in the Neo environment.
Nikola Simeonov N Nikola Simeonov July 14, 2023
Created by July 14, 2023
Contributors

Prerequisites

Prerequisites

Steps

Intro

In this tutorial, you implement a notification application that requests the metrics of the following Java applications (running in SAP BTP, Neo environment):

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

  • app2 located in a2 subaccount and US East region

Since the requests are sent to only two applications, the Maven project that you import in Eclipse only spawns two threads. However, you can change this number in the MetricsWatcher class, where the ScheduledThreadPoolExecutor(2) method is called. Furthermore, if you decide to change the list of applications, you also need to correct the list in the Demo class of the imported project.

When the notification application receives the Java application metrics, it checks for critical metrics. The application then sends an e-mail or SMS, depending on whether the metrics are received as critical once or three times. In addition, the notification application restarts the Java application when the metrics are detected as critical three times.

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

If a Java application isn’t started yet, the notification application automatically triggers the start process.


Step 1 Download the project
โ€”

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

Step 2 Import into Eclipse
+
Step 3 Update Demo.java
+
Step 4 Update `Mailsender.java`
+
Step 5 Test your scenario
+

Resources

Discussion

Share feedback on this tutorial or join the conversation in SAP Community.

Submit detailed feedback Discuss in Community
Steps
Step 1 of 5
1. Download the project 2. Import into Eclipse 3. Update Demo.java 4. Update `Mailsender.java` 5. Test your scenario

Learn more →