So a week or two ago I put together an intro video walking through the basics of Availability monitoring in Application Insights. It covered how to use the portal Availability UI, and how you could use a new doc that was recently published to make your own custom availability monitor and have it live inside an Azure Function.
The Azure Function based availability monitor was cool, but there were some key things it couldn’t do:
- It is hardcoded to monitoring a single site. You can of course modify this behavior, but I found myself wanting a tiny bit more in depth example. (EDIT: This doc has been subsequently updated to no longer support HTTP calls and only provides code demonstrating the TrackAvailability() method.)
- You still can’t perform true Hybrid/on prem availability tests. Coming from the SCOM world I am used to having watcher nodes which I can turn into an army of on-premises URL/endpoint monitoring minions that don’t require opening any incoming firewall rules.
So last Thursday night I started tinkering with seeing how hard it would be create some on prem monitoring minions by trying to take the Availability monitoring via Azure Functions code and cramming it into one of the new .NET Core 3.0 Worker Services. These new worker services were attractive in that I kept hearing the .NET Core team say that they were super easy to turn into long running Windows Services which I have messed around with in the past and always found to be kind of a pain to build from scratch.
Even with hearing all the positive buzz about worker services I was still expecting getting a Windows Service working to be a hurdle. I was wrong, it took about 60 seconds to turn the worker service into a full fledged windows service.
Step-by-step video of the first iteration of how to build out a custom availability monitoring service:
Code for the video above, and new more advanced hybrid/on-premises availability monitoring solutions can be found at: https://github.com/mrbullwinkle/availability-minion.