Skip to Content
Product Information
Author's profile photo Nikola Simeonov

Use the Monitoring Service for Critical Notifications and Self-Healing of SAP Cloud Platform Java Applications

Note: This blog post is outdated. Please find the up-to-date version at Use the Monitoring Service for Critical Notifications and Self-Healing of Java Applications in the Neo Environment.


As an operator, you can use the monitoring service to receive notifications and to fix Java application issues when critical metrics are detected. That way a custom application can notify you through different channels when a critical metric persists for some time. Consequently, the application can take the necessary actions to prevent the SAP Cloud Platform Java application from undesired outcomes such as crashes and loss of data.

Currently, you can use the SAP Cloud Platform tools to configure email notifications only for availability checks and custom JMX checks of running Java applications. That means SAP Cloud Platform can send you an email alert for any critical custom metrics and availability checks. For more information, see Configuring Availability Checks from the Console Client and JMX Checks.

Now by using the monitoring service, you can configure notifications for all the metrics of a Java application. That way you can be notified for any critical CPU and memory usage in addition to the custom metrics and availability checks. Furthermore, you can even customize the way these notifications are sent. For example, the monitoring service can send an email when a metric is detected as critical for the first time and an SMS when it is received as critical three times. Another benefit with such a scenario is that you can be notified for critical metrics of many Java applications located in subaccounts on different hosts (regions). The only requirement in such a case is that your user is a member of those subaccounts.

To use the monitoring service in such a scenario, you just need to develop a notification application that checks for a critical metric and sends notifications through email, SMS, or other channel. To use a channel other than email, you have to configure your server to support it.

This blog describes a scenario in which notifications are sent via email or SMS and assumes that you have configured your server for SMS notifications. A separate tutorial describes in detail how you can develop your notification application in Java (see Tutorial: Implementing a Notification Application).


Process Flow

The communication between your notification application and the monitoring service works as follows:

  1. A notification application requests metrics of an SAP Cloud Platform Java application from the monitoring service with a REST API call every minute.Note: The calls are sent per minute because the Java application metrics are refreshed each minute.For more information about the REST call, see Monitoring API.
  2. The monitoring service sends back a JSON response with a status code 200 OK.The response contains the metrics of the requested application and the states of these metrics.
  3. The notification application parses the JSON response and checks for critical metrics.
  4. The notification application notifies you by the following conditions:
    1. A metric is critical for the first time – you receive a notification email.
    2. A metric is critical three times – you receive an SMS.
  5. The notification application checks if metrics have been critical three times and takes actions for application self-healing (for example, the Java application is restarted).
  6. The notification application repeats steps 1 to 5 for all other Java applications.



Julie Armstrong, as an operator of Company A, would like to configure a notification application that will send her notification alerts for critical metrics of her running Java applications. These Java applications are located in the US and Europe regions. In addition, she decides that when critical metrics are received, the application has to be restarted. For that purpose, she develops a notification application in Eclipse following the instructions in Tutorial: Implementing a Notification Application.



Although this blog describes only the notification and self-healing scenario, you can extend this scenario to use a dashboard application or another tool that displays the metrics of SAP Cloud Platform Java applications. For more information about the dashboard application scenario, see Use the Monitoring Service to Retrieve Metrics from Different SAP Cloud Platform Applications.


More Information

Monitoring Java Applications


Assigned Tags

      You must be Logged on to comment or reply to a post.
      Author's profile photo Krishna Kumar S
      Krishna Kumar S

      Hello Nikola Simeonov,

      Many thanks for this blog. really neatly explained.

      I wanted to clarify - Since monitoring API is now available, does this mean that we need not use JMX checks/ availability monitoring any more? As we can monitor all metrics with Monitoring API.

      Any inputs from you on the above is much appreciated.




      Author's profile photo Nikola Simeonov
      Nikola Simeonov
      Blog Post Author

      Hi Krishna,

      No, you can use both. The advantage with the monitoring API is that you can get notified for critical states of all the metrics you receive. If you configure the notifications through the HCP tools (cockpit and console client), you get notified for some metrics only. Hence, the API is better, but requires some development effort as this blog explains.



      Author's profile photo Krishna Kumar S
      Krishna Kumar S

      Hi Nikola,

      Many thanks for the clarificaiton.

      Regards, Krishna

      Author's profile photo Vesselin Mitrov
      Vesselin Mitrov

      Using an API instead of cockpit/console is also very convenient as a programatic approach towards automation of operations around the Java apps in HCP.

      Author's profile photo Andrea Bosoni
      Andrea Bosoni

      Hi Nikola, is this already available - or in roadmap - for HCP Integration Services as well?


      Author's profile photo Nikola Simeonov
      Nikola Simeonov
      Blog Post Author

      Hi Andrea,

      I do not know what you mean exactly. You can use this public REST API to retrieve the metrics of Java applications located in SAP Cloud Platform. Your integration service can use the API too. The API is publicly available for customers.