In last article, we discussed about how to get started with Application Insight in your web applications. In this article, we will discuss how to monitor the application to ensure its availability and responsiveness.
Azure Application Insights has feature which sends request to your application in the defined interval and checks the availability and responsiveness of the application. In case there is any unexpected behavior like application is slow or not responding it can send alert.
Let’s start setting up availability check of the API developed in last article.
Step 1: Right click on the Project created in last article and click on Publish. If you have already published, you can skip this step.
Step 2: Login to your Azure account and click on Application Insights from hamburger menu followed by the Application Insight name we created in last article which is “TestApplicaitonInsightBlog” or click on the Application Insight you have created.
Step 3: Click on Availability option of “TestApplicaitonInsightBlog” as shown in below image.
Step 4: Now click on Add web test and give Test Name of your choice (I have given “GetEmployeeAvailability”) and fill the URL field with published azure API (In this it is GET API of Employee)
There are few more things which can be configured
i) Test Frequency which determines how frequently you would like the URL to be tested from the list of 5, 10 and 15 minutes.
ii) You can also select the location from where Web Test needs to be performed. By default, Web Test will be performed from 5 locations.
iii) Success criteria where success criteria will be determined based on the Test Timeout, Status Code and you can also specify content must contain.
iV) Alerts is very important in availability so that you will be notified in case of any failure. It can be customized on number of failed location, when failure is more than specified time and multiple email address with semicolon can be provided where mail will be triggered to alert in case of failure.
You can also use Webhooks of other systems to send SMS, log bugs or notify another team.
Step 5: Once all the data points filled and selected as per your requirement, click on Create button. The GetEmployeeAvailability Web Test will be created.
It will be in disable state because no data is available to show. After 5 minutes it will be activated and you will able to see the result.
Step 6: Click on Refresh after 5 minutes and you will notice GetEmployeeAvailability will have green tick mark. On click of it will show detailed status report of the API availability. On mouse over on the dots you will see the response time from each location from where API is being tested.
At any time you disable or delete Web Test
by clicking on More option from top right corner of the screen.
This ends the article of Availability check
of API using Azure Application Insight.