Availability Tests

Posted by

Today we are going to setup availability testing in Application Insights. An availability test is a simple test that confirms that the resource is responding to requests, and hence, available.

Creating the availability test

Creating the availability test is a quick process. First we open up the Application Insights instance we are going to add the test too, and open the “availability” section. Then we click on “Add test” to create a new test.

We fill in the details, adding a test name, using the “URL ping test” test type, and then entering the URL to test. It’s important to remember to add the “https://” prefix to this URL. All of the other settings are left in their default state. You’ll notice that the test frequency is every 5 minutes, and 5 locations have been pre-populated. (East US, Central US, North Central US, South Central US, West US). Every 5 minutes, a ping test will be run from each of the 5 locations, to confirm that the site is still available.

The results show very quickly, (apart from a hiccup at the beginning where we learned that not adding the “https://” is a bad idea), it works very well.

Updating the ARM template

Now we are going to generate the infrastructure as code and add this test to our ARM template. Unfortunately, as we’ve found in a previous post, setting up the ARM template is not straight forward.

First, we export the alert we created manually in the last step. This gives us the base JSON document that we add into our ARM template. We replace the parameters with our own variables, and immediately note that the criteria is blank. We’ve seen this before, this is a known issue with the Azure Portal export. Last time we ran the AZ CLI code to see the criteria, but for whatever reason, this doesn’t work this time. Fortunately the resource explorer can help us! Opening the resource explorer, we browse to the resource group, select the alert, and we can see the criteria we need! We paste it into the criteria section of the ARM template.

Summary

Today we’ve added availability tests to our project, giving us another metric to help monitor our application in Application Insights.

References

One comment

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s