The content below is taken from the original ( Monitor Your Website’s Availability with Azure Application Insights), to continue reading please visit the site. Remember to respect the Author & Copyright.
Do you know the uptime statistics for your website? If not, Azure App Insights makes the statistics easy to find. App Insights can execute both basic and multi-step availability tests against any http or https URL. It doesn’t matter if your site is hosted on a VM, in Azure App Services, or on a Raspberry Pi in your closet. If the web site is public, AppInsights can run these availability tests in addition to collecting telemetry, metrics, and errors.
The first step is to create an App Insights resource in Azure. If you’ve never setup App Insights before, then you can follow the directions in Microsoft’s App Insights overview.
Once the resource is ready, go to the Availability blade and click the “Add Test” button. If you created App Insights in concert with an App Service resource, Azure might have already configured a default test. You can click on the Details tab to see the list of all existing tests.
There are two types of tests in App Insights. The first is the basic ping test. With the ping test you give AppInsights a single URL to examine. The other type of test is the multi-step web test where you give App Insights an XML .webtest file. If you’ve ever generated load or web tests using Visual Studio, then you’ll recognize the .webtest file extension. Just be aware that Microsoft has deprecated webtest features in Visual Studio, so I’d stick to using the ping test.
Test Configuration
With the ping test, App Insights will send a web request to the URL you specify and watch for a timely response. You can setup a ping test to parse dependent requests, meaning if your test URL responds with HTML, App Insights can go looking for resources embedded in the HTML, like script and image resources. App Insights will fire off requests for these embedded resources, too.
You can configure the test frequency to run tests every 5, 10, or 15 minutes. What’s even more interesting is that you can specify multiple locations to originate the test requests. I have an availability test for my personal web site, for example. I host my site, odetocode.com, in Azure’s East US region. I run availability tests from East US, West US, UK South, North Europe, and Australia East regions. It’s interesting to see the latency difference between tests that start from opposite sides of the earth. Most of the test requests from the East US respond in less than 110 ms. The high points you see in the chart below are the occasional requests from Australia that run more than 500 ms.
For each test you can specify the criteria for success. With my site, for example, I look for an HTTP status code 200 in the response, and I ask the response time to be less than 30 seconds. I also configured App Insights to fire an alert of at least 3 locations fail the basic test in a 5 minute window.
App Insights saves all the test results so you can explore the results later, either by charting the results with a custom time range right from the Azure portal or sending queries to the App Insights API. You can drill into failures and, if you hook your application telemetry into App Insights, look at telemetry around the time of a test. I had one test recently that stood out because the test waited over 90 seconds for a response. Taking a closer look, I saw the response never reached my web site, and I could sleep better knowing the problem was not in my code or configuration. I could blame the slow response on a DNS server.
Additional Resources
App Insights gives you everything you need to monitor the availability of your web sites, and more. Here are some additional resources to find out more.
- What is Application Insights?
- Monitor availability and responsiveness of any web site
- Video: Monitoring Availability with Application Insights
The post Monitor Your Website’s Availability with Azure Application Insights appeared first on Petri.