With the current SAP BTP tools, you can configure email notifications for critical metrics of custom JMX checks and availability checks. This configuration is applicable for metrics of a running Java application. For more information, see Configuring Availability Checks from the Console Client and JMX Checks.
However, you might want to be notified for other critical metrics of running Java applications. Furthermore, you might need to perform healing operations when such metrics can cause issues such as low performance or crashes. This tutorial is to help you implement a notification application that will watch each metric for a critical state, will notify you via email or SMS when such metrics are received, and will take actions to fix the issues caused by such metrics. Furthermore, the Java applications that the notification application receives metrics from can be located in different accounts and data centers. The communication between this custom notification application and the Java applications is as follows:
-
The notification application requests metrics of a Java application from SAP 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 Metrics API.
-
SAP 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.
-
The notification application parses the JSON response and checks for critical metrics.
-
The notification application notifies you by the following conditions:
a. A metric is critical for the first time – you receive a notification email.
b. A metric is critical three times – you receive an SMS. -
The notification application checks if metrics have been critical three times and takes actions for application self-healing (the Java application is restarted).
-
The notification application repeats steps 1 to 5 for all other Java applications.
Download this project locally and follow the instructions in Tutorial: Implementing a Notification Application.
Yavor Mladenov
Nikola Simeonov
See Contributing to an SAP Open Source Project
Copyright (c) 2015-2023 SAP SE
Except as provided below, this software is licensed under the Apache License, Version 2.0 (the "License"); you may not use this software except in compliance with the License.You may obtain a copy of the License at:
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Detailed information including third-party components and their licensing/copyright information is available via the REUSE tool.