Endpoint Monitoring with Azure Application Insights
Let’s work with Application Insights - an Microsoft Azure service - to monitor our application through the endpoint /healthcheck.This is the third article about Health Checks and Application Monitoring.
Bookmark this

Let's work with Application Insights - a Microsoft Azure service - to monitor our application endpoint /healthcheck.

This is the third article about Health Checks and Application Monitoring.

  1. Adding Health Check endpoint
  2. Adding UI Health Check
  3. Using Application Insights Endpoint Monitoring --> this article
  4. Using Azure App Services Endpoint Monitoring

This article assumes that you have a Health Checks endpoint up and running available over the internet.
If not go back to this article to set up and them return here.
The Health Check UI is not necessary for this article, only the API endpoint.

Introduction

Applications Insights it's a great tool for monitoring, error logging, performance monitor, dependency mapping, and other things. In other words, it's a fully APM - Application Performance Management.

Application Insights, a feature of Azure Monitor, is an extensible Application Performance Management (APM) service for developers and DevOps professionals.
https://docs.microsoft.com/pt-br/azure/azure-monitor/app/app-insights-overview

Pricing

Pricing https://azure.microsoft.com/en-us/pricing/details/monitor/

According to https://azure.microsoft.com/en-us/pricing/details/monitor/ the ping test is always free.

Requirements

Our API should be available over the internet (Application Insights should have access to hit it).
I published mine at https://webapphealthchecks.azurewebsites.net/
You can use it for testing purposes if you like.

Creating Application Insights Resource

Access the Azure Portal at https://portal.azure.com and access the Application Insights blade and the click Add to create a new resource.

Create Application Insights Resource

Enter all the required information to create the resource, such as subscription, resource group, etc.
When asked for the Resource Mode choose the Classic.

Creating the AI

Once the Application Insights it's created, go to the Availability section.
This is where the monitoring tool is configured to watch our endpoint.

Go to Availability

Now click on the +Add Test button.

Adding Test

Fill the required information.

  • Test name: AI-Ping-WebApp
  • Test Type: URL ping test
  • URL: https://webapphealthchecks.azurewebsites.net/healthcheck
  • Parse dependent requests: unchecked
  • Enable retries for availability test failures: checked
  • Test frequency: 5 minutes
  • Test locations: default values
  • Test Timeout: 120 seconds
  • HTTP Response: checked
  • Status code must equal: 200
  • Content match: checked
  • Content must contain: Healthy
  • Alerts: leave as default

And them Create.

Now just wait for the tests begin and show the results. After a few minutes, you should get something like this.

Line View Test Results
Scatter Plot Test Results

That is it!
Leave a comment if you have any questions or like it.