Endpoint Monitoring with Azure Application Insights
Let's explore the use of Microsoft Azure Application Insights to monitor the health of our application using the endpoint /healthcheck.
Applications Insights it's a great tool for monitoring, error logging, performance monitoring, dependency mapping, and other things. In other words, it's a full APM - Application Performance Management - ready for you to use in Production Environments.
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
💬 In this Issue
- Recap of Previous Articles
- Check the Prices Before Use in Production
- One Simple Requirement
- Creating the Application Insights Resource
- Conclusion - The Results
Recap of Previous Articles
This is the third article about Health Checks and Application Monitoring.
- Adding Health Check endpoint
- Adding UI Health Check
- Using Application Insights Endpoint Monitoring --> this article
- Using Azure App Services Endpoint Monitoring
Check the Prices Before Use in Production
Check out the prices before adopt in your work project.

Check the latest updated prices at https://azure.microsoft.com/en-us/pricing/details/monitor/.
One Simple Requirement
Our API should be available over the internet (Application Insights should have access to hit it).
This article assumes that you have a Health Checks endpoint up and running available over the internet.
Go back to this article to set up and then return here.
The Health Check UI is not necessary for this article, only the API endpoint.
I published mine at https://webapphealthchecks.azurewebsites.net/
You can use it for testing purposes if you like.
Creating the Application Insights Resource
Access the Azure Portal at https://portal.azure.com and access the Application Insights blade and click Add to create a new 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
.

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

Now click on the +Add Test
button.

Fill in 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 then Create.

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


😎 Final thoughts
Wow, finally we made it. That is enough!
Of course, we can keep going adding more monitoring and making more use of Application Insights.
Share in the comments section what you would do to make it even better or different.
❤️ Enjoy this article?
Forward to a friend and let them know.