Visual Studio Application Insights – Application Availability and up-time monitoring for free!

I know there are already apps out there that perform application uptime monitoring (and I’ve had to build one or two myself in the past), but now Microsoft have released (in preview) a way to monitor your on-premise and cloud applications using Visual Studio Online – Application Insights. Best of all, it’s free!

From what I can tell thus far, it allows one to monitor not only server metrics such as CPU, network utilization etc, but also perform uptime tests, by either pinging application urls (as defined by you), or running Visual Studio web tests which you’ve already written and exported to file.

Setting up application insights for The Kangaroo Court (or any Azure web role)

After reading about application insights today on Brian Harry’s blog, I thought why not try implementing it on The Kangaroo Court? FYI – The Kangaroo Court is a site hosted on Windows Azure, using a web role as part of a cloud service, so I won’t be covering the steps you’d go through for an on-premise application.

Below are the steps to go through to get it up & running:

  1. Get a preview invitation code – I got mine from http://blogs.msdn.com/b/bharry/archive/2013/11/16/another-application-insights-invitation-code.aspx
  2. Go to the Visual Studio online site, hit the Try application insights link, then enter your invitation code (which hopefully is still valid)
  3. Follow the wizard – I selected the hosted in Azure cloud service option – and then download the two files as explained in the wizard
  4. Copy the downloaded files into Visual Studio as explained in the wizard
  5. Update your serviceconfiguration files. Note that the wizard only said I needed to update my serviceconfiguration.cloud.csdef file, however, I had to update both the cloud and local files. If you watch the video provided, it shows the user updating both anyhow, so no problem there. Note also that if you already have a ConfigurationSettings or Startup section defined in your file, you’ll simply need to update the sections with the new configuration variables and startup task from the code provided by the wizard, rather than copying over the entire ConfigurationSettings and Startup sections. I initially did this, and as expected, Visual Studio told me things were broken!
  6. Check in and redeploy the cloud service to Azure, then wait 10 minutes or so
  7. Go to the Application Insights page on the Visual Studio website. My url looked like this: https://my-username.visualstudio.com/_appanalytics/_overviews/dashboards.
  8. Check out the data that should be streaming in! (If there’s no data there, wait a while longer, and make sure that your cloud service is up & running too.)

Image

I particularly like the Dashboards tab, which allowed me to setup a dedicated dashboard for the Kangaroo Court, showing key metrics. I could then drill down into the Performance tab if I needed to see more information. See the screenshot below for my example dashboard:

Monitoring site uptime and availability

The next step was to setup some uptime monitoring, so I could make sure The Kangaroo Court website was up & running, and that if it wasn’t, I would know about it. As an aside – In my view this is an often-overlooked and yet essential feature for any website, as most developers I know (and certainly business stakeholders) would rather know that their site was down BEFORE any customers did, rather than finding out later on that their site was down for hours before they knew about it, and they’ve lost business because of it… This is particularly true for sites where the only way a customer can inform you of any errors is via a Contact Us page, which is pretty useless if the site isn’t available for users in the first place.

With that in mind, I went to the Availability tab, and added a new ‘Synthetic monitor’. By default the first one your create is called my_first_test, andI couldn’t figure out how to rename it. I also couldn’t find a way to add additional tests, so simply had to update the single test to suit my scenario (pinging the Kangaroo Court homepage) as shown below (note that my email isn’t shown):

Image

As you can see, I set it up to ping the site every five minutes from two locations:

  • One in Sydney
  • One in the US

If 2 locations failed within a ten minute window, I will be sent an email notifying me that the site is down, so that I can then take appropriate action. Awesome!!!!

Well that’s all I’ve done thus far, but as you can see, Application Insights provides some pretty cool features out of the box, and I haven’t even dug too deep into it yet. I’ll continue to explore and hopefully post more soon. Till then – enjoy!

Ps. If you have a sports team with a fines system, or are thinking of starting one – please do check out The Kangaroo Court

Advertisements

Azure finally gets a job scheduler!

Yes I know they already had scheduling available in mobile services, but now it looks like job scheduling (aKa Cron jobs) will be one of the standard features in Windows Azure – woohoo!

As per the documentation – http://www.windowsazure.com/en-us/services/scheduler/ – the scheduler can be used to:

  • Perform GET/POST requests against your application urls and/or
  • Send messages to Azure service bus for your worker roles to act upon

I’ve been waiting for this feature for ages, as I’ve had to rely on other Cron services such as SetCronJob for this sort of functionality in the past (where the Cron service calls one of my website urls, which then performs the work and returns a 200 status code for success). Whilst SetCronJob is great, it’s nice to be able to perform the scheduling within Azure, so it can sit alongside the other components of whatever service you’re building. 

Currently the scheduling service is in preview and available via the REST API (there’s a Nuget package to use it), but no doubt it will soon be added to the management portal. 

Thanks for adding this Microsoft!!!!

Keeping sensitive config settings secret with Azure Websites and GitHub

During my foray into Azure web sites as part of the Windows Azure Developer challenge, I came up with what I think is a useful pattern for keeping your sensitive config settings secret when using Azure websites and GitHub. It allows you to:

  • Access them when debugging locally
  • Access them when deploying to the cloud
  • Stop them getting into source control on GitHub where others can see them

You can read all about it at http://www.codeproject.com/Articles/602146/Keeping-sensitive-config-settings-secret-with-Azur 

Don’t forget to vote for the article if you like it. Also, keep an eye on my daily progress in the challenge at http://www.codeproject.com/Articles/584534/YouConf-Your-Live-Online-Conferencing-Tool