Technology Blogs by SAP
Learn how to extend and personalize SAP applications. Follow the SAP technology blog for insights into SAP BTP, ABAP, SAP Analytics Cloud, SAP HANA, and more.
cancel
Showing results for 
Search instead for 
Did you mean: 
dzhurdzhina
Advisor
Advisor
Do you already make use of AWS solutions monitored by Amazon CloudWatch? And is it altogether with SAP Cloud Platform applications and services? If so, you've definitely thought of a common alerting mechanism, haven't you? In this regard, we have some content for you. SAP Cloud Platform Alert Notification is capable of processing alerts specific to Amazon CloudWatch and sent by Amazon Simple Notification Service.

Today, we’ll walk through a scenario where SAP Cloud Platform Alert Notification (referred to as Alert Notification) gathers alerts related to our DynamoDB in AWS. For this purpose, we will leverage the integration between Amazon CloudWatch (referred to as CloudWatch), Amazon Simple Notification Service (referred to as Amazon SNS) and Alert Notification. At the end, we'll receive a Microsoft Teams message for the upcoming alert.


As prerequisites, a couple of points are needed before starting:

  • An active license or subscription for SAP Cloud Platform Alert Notification; if not, Discover the service;

  • An Active account in AWS;

  • (Optionally) Microsoft Teams channel.


 

Set up SAP Cloud Platform Alert Notification






Let’s start by configuring SAP Cloud Platform Alert Notification. To achieve our scenario, we need a couple of steps to prepare:

  • get credentials that will be used from Amazon SNS to authorize against Alert Notification;

  • instruct Alert Notification to send us a Microsoft Teams message for each alert received from Amazon SNS.


Starting by the credentials, let’s navigate to our Alert Notification instance within the SAP Cloud Cockpit, then go to the Security menu (for Neo accounts) or to the Service Keys menu (for Cloud Foundry accounts). Now we are ready to create a credentials pair of type BASIC authentication that has the ALERT_WRITE permission. To achieve this, do the following according to your environment:

  • for Neo, follow the steps described here

  • for Cloud Foundry, follow the steps described here


Note: Once, the credential pair is created, make sure to save the client id and client secret in a secure place, so that we could use them later while configuring Amazon SNS.

Next, let’s set up Alert Notification to match any notification coming from Amazon SNS and send it to our MS Teams channel. To achieve it, we’ll import a predefined action, condition and a subscription:

Note: Before importing, ensure you’ve replaced the Microsoft Teams Webhook URL placeholder. If not sure how to get it, check hereIf you do not have an MS Teams channel you could replace it with another delivery option from the SAP Cloud Platform Alert Notification portfolio.
{
"conditions": [{
"name": "AllAmazonEvents",
"propertyKey": "eventType",
"predicate": "STARTS_WITH",
"propertyValue": "Amazon"
}],
"actions": [{
"name": "NotifyMeInMicrosoftTeamsChannel",
"state": "ENABLED",
"type": "MICROSOFT_TEAMS",
"properties": {
"destination": "<your.microsoft.teams.web.hook.url.here>"
}
}],
"subscriptions": [{
"name": "AllAmazonEventsToMyMicrosoftTeamsChannel",
"state": "ENABLED",
"conditions": [
"AllAmazonEvents"
],
"actions": [
"NotifyMeInMicrosoftTeamsChannel"
]
}]
}

Set up Amazon Services






Amazon Simple Notification Service

Let's start by configuring Amazon SNS to forward messages to Alert Notification. Firstly, we should create a topic and then create a subscription in this topic:

  1. In the AWS Console look up for Simple Notification Service and select it

  2. Navigate to Topics

  3. Click on Create topic

  4. Fulfill needed Details and click on Create topic button at the bottom

  5. In the newly created topic view, click on Create subscription

  6. Choose HTTPS protocol

  7. Fulfill the Endpoint using the template below and replace the placeholders as follows:
    https://<username>:<password>@<base-url>/<environment>/producer/v1/resource-events?schema_definition...




    • replace <username> with the URL-encoded value of the client ID received upon creation of Alert Notification credentials in the previous section;

    • replace <password> with the URL-encoded value of the client secret received upon creation of Alert Notification credentials in the previous section;

    • replace <base-url> with the value of the url property in your service key (for Cloud Foundry environment) or with the Base URL available in the Security view in Neo accounts;

    • replace <environment> with cf for Cloud Foundry environment or with neo for Neo environment.




Once the subscription is created, an automatic message will be delivered to the Microsoft Teams channel where the previously provided Webhook was created. It is sent by Amazon SNS with confirmation purpose. Follow the link in the SubscribeURL event tag:




Having this subscription confirmed, we’re ready to start our demo scenario. Moreover, from now on we’re going to receive any message published to this topic over our Alert Notification instance.
Amazon DynamoDB

We'd need to create a table in Amazon DynamoDB. If you already have an existing one, you could safely make use of it and skip the steps below:

  1. In the AWS Console look up for DynamoDB and select it

  2. Navigate to Tables

  3. Click on Create table

  4. Fulfill needed Details and click on Create button at the bottom


Amazon CloudWatch

In this section, we are going to create a CloudWatch alarm to observe our DynamoDB table. It would be quite a simple one – an alert will be triggered in cases when more than 1 write per 1 minute is executed.

  1. In the AWS Console look up for DynamoDB and select it

  2. Navigate to Tables

  3. Click on previously created table

  4. Navigate to Alarms

  5. Click on Create alarm

  6. Configure the alarm:

    • SNS Topic: <Previously created Amazon SNS topic>

    • Whenever: Consumed write capacity

    • Is: >= 0.034 Average Units/Second

    • For at least: 1 consecutive period(s) of 1 minute

    • Treat Missing Data As: good (not breaching threshold)

    • Name of the alarm: <a meaningful alarm name>



  7. Finally, click on Create Alarm button at the bottom


Execute the scenario






It's time to test what we have prepared so far. Let's write a couple of times in our DynamoDB table:

  1. In the AWS Console look up for DynamoDB and select it

  2. Navigate to Tables

  3. Click on previously created table

  4. Navigate to Items

  5. Click on Create item

  6. Enter some value

  7. Click on Save

  8. Execute steps 5,6 and 7 two more times. At the end we should have 3 newly created records in our table


Within seconds, you'll receive a message in your MS Teams channel like the following:


 

Further information on this scenario and exact property value mapping, you could find in the dedicated SAP Help Portal page.




This blog post is part of a series of blog posts related to integration between third-party monitoring tools and SAP Cloud Platform Alert Notification service. We will continuously add newly released integrations, so stay tuned!

We ask you – our customers and partners – to join us in our integration journey! Tell us what you use for monitoring solutions, what you need to integrate with them; tell us your experience, and what your alerting needs are!
2 Comments