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.
Go to General, select the connectors, look for incoming webhook, add the incoming webhook. Click on confígure.
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.
Connection to the incoming webhook has been set up.
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.