Application Insights Azure Azure Monitor

Azure Monitor – Application Insights Status Monitor v2 (Part 1)

Bildergebnis für application performance

Do you have a .NET application running somewhere in your datacenter or in the cloud and you have the need to monitor it properly? Maybe you need some APM tool or you just want to diagnose, if there are any failure or issues and what it might be causing these problems? In addition, you might are not able to instrument the application with some additional code fragments, but still want to catch as much application performance data as possible?. Well, then this post could be for you!

Status Monitor v2 is a PowerShell module published to the PowerShell Gallery. It replaces Status Monitor. The module provides codeless instrumentation of .NET web apps hosted with IIS. Telemetry is sent to the Azure portal, where you can monitor your app. (Microsoft)

This sounds great and I wanted to try it out.

But before we can start we need a proper environment. So we will first configure an IaaS VM in Azure having a sample .Net application installed and then use the az.applicationinsights module to monitor the environment using Application Insights. Sounds exciting? Let’s start…

Setup

In Azure DevTest Labs I created a lab and provisioned an IaaS VM based on the “SQL Server 2016 SP2 Standard on Windows Server 2016” image…

1

… during the setup installation, I also added the artifact which installs IIS after successful VM deployment…

2

…after this basic setup, I needed to add some IIS features in order for the application to work properly. This is the listing of all installed features…

image

Next, we will configure IIS on the VM but before we can do that, we need to download the application. I was searching the web for a usable candidate and finally came up with Smartstore .NET, an e-commerce solution based on ASP .NET MVC and a SQL Server backend. First, download the application and extract it into a subdirectory of IIS…

image

…configure a dedicated application pool…

image

…and IIS website running on port 81…

image

Now, we should be able to navigate to the local website where we get redirected to the installation frontend. I enabled the “sa” account on the local SQL Server to install the database automatically and after a while…

24

…we get the message…

25

…and then the shop is there. The cool thing is, that we could select to add sample data during the shop setup…

26

If you are running into any configuration error I recommend using this post here on Stackoverflow.

Codeless Instrumentation

There is a detailed description on Microsoft how to install the PowerShell module, however following that documentation lead to errors…

27

…additionally there is a known-issue page as well, where you could start troubleshooting. I preferred, to manually download the nuget package from the PowerShell Gallery and installed it.

28

…so I downloaded it to C:\temp and ran the following command…

$pathToNupkg = "C:\temp\az.applicationmonitor.1.0.1.nupkg"
$pathToZip = ([io.path]::ChangeExtension($pathToNupkg, "zip"))
$pathToNupkg | rename-item -newname $pathToZip
$pathInstalledModule = "$Env:ProgramFiles\WindowsPowerShell\Modules\az.applicationmonitor"
Expand-Archive -LiteralPath $pathToZip -DestinationPath $pathInstalledModule

…and succeeded…

30

…if we run the Get-Command –Module “az.applicationmonitor”, we see all available commands…

31

As a last step, we need to deploy an “Application Insights” instance in Azure…

32

…then get the instrumentation key…

33

…and connect our application to “Application Insights”…

33

…and it looks we have a successful installation…

35

…Whohooo, seems that the website is connected.

First, we go to the “Live Metrics Stream” section in Application Insights and watch the data floating in after a couple of minutes…

34

…after a while we can see the “Application map”…

image

In the next post we are going to explore the data received and other options the PowerShell module offers.

Enjoy!

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.