Pre-read
This blog post is part of
a series of blog posts related to SAP Cloud Platform Alert Notification service.
You can relate to the parent blog post for more detailed information about the service itself.
In this particular blog post, we are going to explore the topic - how to understand that some part of your HTML5 application in SAP Cloud Platform Neo is not available?
For sure you don't want to proactively watch the Cloud Cockpit to understand that your HTML5 app is unavailable or too slow, right?
In that case, you have to do two things:
- Create a custom HTML 5 check
- Bind this check to SAP Cloud Platform Alert Notification and receive alerts whenever it breaks via any channel you want.
Defining HTML5 custom check
Let's start with the check definition. To do so, simply open the Cloud Cockpit and
create a custom check for your HTML5 application.
The screenshots below show the process.
We have an HTML5 application called "my sample app", click on its name and navigate to the Application Monitoring section
In it click the "Create Custom Check" button.
Fill the information about the custom check. In that very case, I have named the metric
Root Page Availability. The is going to check the root URL of my application.
Then click the Create button, and the metric will be alive in a minute time.
Defining Subscription in SAP Cloud Platform Alert Notification
While you wait for the metric to start reporting data, you can set the
alert subscription
However, the first step to do that is to subscribe to the SAP Cloud Platform Alert Notification. If you haven't already done so, follow
these steps.
Below you will find a step-by-step procedure of how to create the alert.
Once you have subscribed to the service, open its UI and navigate to the Subscriptions section, then click the Create button.
Define the subscription name, you can also define labels to find this subscription easier on a later period. Click on the Create button.
On the next screen, it is time to assign a condition. If you haven't
created conditions so far, this section should be empty. So simply click on the Create Condition button.
It is the type to set the condition, which is the most essential part. You can receive an HTML5 alert in
many ways. For instance, you can match by the application name, or by the resource type. In that very case, we are going to match the eventType.
The event type should be equal to the custom check name but without the intervals. So "Root Page Availability" is converted to "RootPageAvailability."
Once this is done, click on the Create button.
Next step is to configure where we want to receive the alert. In that blog post, I will use email.
Please
refer to the documentation to understand more about actions.
Fill out the required information and click on the Create button.
Note that if you chose email or Slack actions, later on, you should confirm them to be able to receive alerts via them. To do so simply follow step 5 from that page
Once this is done, we have our subscription created.
Testing the alert
To check the alert, simply stop your HTML5 application. After a minute or two, you will receive an alert via the channel you have selected. In our case, the email.