Quantcast
Channel: SCN : Blog List - All Communities
Viewing all articles
Browse latest Browse all 2548

Use the Monitoring Service for Critical Notifications and Self-Healing of HCP Java Applications

$
0
0

Overview

As an administrator, 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 HCP Java application from undesired outcomes such as crashes and loss of data.

Currently, you can use the HCP tools to configure email notifications only for availability checks and custom JMX checks of running Java applications. That means SAP HANA 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.

Overview.png

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 different data centers.

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 (see Tutorial: Sending E-Mails) 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:

Notification Scenario_blog.png

  1. A notification application requests metrics of an HCPJava 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.


Example

Julie Armstrong, as an administrator 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 EU data centers. 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.

The application that she implements requests the Java application metrics each minute with the following calls:

The notification application sends an email when a critical metric is received and an SMS when such a metric is received three times. In addition, if a metric is returned as critical three times ("state":"CRITICAL" in the JSON file), the notification application restarts the HCP Java application by using Lifecycle REST API.


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 HCP Java applications. For more information about the dashboard application scenario, see Use the Monitoring Service to Retrieve Metrics from Different HCP Applications.


More Information

Monitoring Java Applications



Viewing all articles
Browse latest Browse all 2548

Trending Articles