Technical Articles
SAP Alert Notification Service : Send Notifications to E-mail, Microsoft teams
Introduction
SAP Alert Notification service for SAP BTP offers a common API for providers to publish alerts and for consumers to subscribe to these alerts. It is designed to send automatically real-time notifications and alerts about events that may be of interest to the business and operations.
Read more on SAP Alert Notification Service
Purpose
This blog explains about
- Subscribe to alert notification service in BTP Cockpit.
- Creating a Disk Usage Alert.
- Creating Actions i.e. Email & Teams Notification
Subscribe to alert notification
Go to your space and click on instances. Click on create and select Alert Notification as Service.
Choose standard plan and instance name for the service.
Skip the next step, then create the subscription. Once created, open the instance by clicking on it.
Create a Subscription for Disk Usage Alerts
In your alert notification service, go to subscription, click on create.
Enter the Subscription name and click create, Next you have to create the conditions. You can create a more than one conditions for your subscription. Also, have the mandatory field checked for better results.
When you create the condition with respect to the eventType, check the SAP HANA Cloud Service Database Events
You can create few more conditions to filter the alerts.
Now, once all the desired conditions are created, you can select all the conditions needed for a particular condition at once. These conditions will be visible as available conditions when ever a new subscription is created.
Once assigned, Create action for your subscription.
Create Actions
1. Create a action for Email
Enter the name and the description.
Enter the email address where you want to send the alerts related to the disk usage subscription.
Click on create, the action will be visible on the available actions. Select and click next. Review the summary of the subscription and click on close.
2. Create an action for Teams Channel
In order to receive the notification on Microsoft teams, you have to configure the Incoming Webhook.
Create a channel in your teams where you want to receive the notifications for the alerts.
Add a name to the webhook and click on create.
Copy the URL and save it. You need this URL to add it to action in our alert notification subscription.
Now you can go to the subscription and add a new action item called ‘Send2Teams’.
Add the webhook URL in the field and create the action.
Add this action to the DiskUsageEvent subscription
Test the action
We can test the subscription by sending the test event. Replace the existing JSON and add the parameters that match the conditions of the subscription.
Note : JSON has to be edited in a text editor and then add it to the sample test event.
Copy the below to a text editor and add the matching condition to the same as shown below in VS code.
Send the test event.
Now, you will receive an email with all the details such as type, category and severity etc.
Also, you will receive a teams notification on the Alerts channel.
Test via Alert Definition
In the SAP HANA Cockpit. go to the alert definitions and select disk usage. Adjust the Thresholds for Prioritized Alerting as shown below and click on Check now.
You will receive the email & teams notification for the same.
You can try the same steps for other events that’s defined in SAP Alert Notification Service Events.
Please share your feedback !
Hi Shraddha Shetty,
That's a very described and complete article about the SAP Alert Notification Service.
Kudos for the nice work and the contribution.
Thank you very much!
All the best,
Vini
Thanks for sharing Shraddha Shetty! How about closing the loop once you pushed the notification?
That "ping" on Microsoft Teams will spark a follow up task. In case it requires an action on BTP a simple jump target on that adaptive card that you shared in the second to last screenshot goes a long way.
Even better is more complex integration enabling BTP API calls to increase disc space from that adaptive card to stick with your sample. The pattern is applicable to any alert scenario with follow up action. We advocate not to stop at the message but offer integration to automate the following tasks fostering true automation. And closing alerts once consumed.
Alerting is not enough nowadays in my opinion.
KR
Martin
Hi Martin Pankraz !
You comment about extending the use case and brining an automated (remediation) action is straight to the point and I would like to suggest checking out SAP Automation Pilot.The primary goal of SAP Automation Pilot is to simplify and automate complex manual processes in order to minimize the operational effort behind any cloud solution in the SAP Business Technology Platform. By using the means of its minimalistic model, you can automate a sequence of steps executable by a machine. The service is designed to work with low latency even when it is under a heavy workload.
I share also a quick overview about SAP Automation Pilot capabilities:
Here it is a link to the help documentation as well.
Moreover, I share a quick overview about some possible use cases:
Of course, in case of any possible questions / comments from your side - please just ping me or write to me directly at biser.simeonov(at)sap.com
Kind regards,
Biser
Hi Biser,
Conceptually that is what I was talking about. However, the Automation Pilot region coverage is rather sparse. Azure PaaS is available in any region with serverless consumption patterns.
Nevertheless, great for customers to choose the automation path and workflow engine that fits their requirements best.
KR
Martin
Hi Shraddha ,
Thanks for a Good Blog .Can you please tell me -
Regards
Venkatesh
The following tutorial provides an example of executing a SQL query in a Python Script in the SAP Automation Pilot and then triggering an Alert Notification Service alert based on the results of the query. I hope that helps further.
Execute SQL Commands and Create Custom Notifications with SAP Automation Pilot and SAP Alert Notification Service
Regards,
Dan