DEV Community

Cover image for Endpoint Monitoring with Azure Application Insights
Ricardo
Ricardo

Posted on

Endpoint Monitoring with Azure Application Insights

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.

Also, check out my blog at https://rmauro.dev

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

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 then 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-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 default value

And them Create.

Creating the test

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.

Top comments (2)

Collapse
 
rmaurodev profile image
Ricardo

What do you think? Did you use this service in the past? Does It help with your daily task?
Share some thoughts. :)

Collapse
 
ghospel profile image
Jasper

Could it be possible to show which of your healthchecks failed? (assuming your have more than one, .e.g. one for a DB, one for some external service etc etc)