Monitoring .Net Applications for Performance and Health

Monitoring .Net Applications for Performance and Health 150 150 Andrew Page

Introduction

As part of the support service that we provide to our customers, we undertake to regularly monitor the health and performance of our applications. This way, we can proactively resolve any problems that may be impairing the quality of the user’s experience.

For applications that are deployed to the cloud using managed services, a host of monitoring facilities are commonly provided as part of the underlying service from the hosting provider. For example, various health and performance monitoring widgets are available on the Windows Azure Portal to allow use to monitor the services we have subscribed to (to include App Services for our websites).

However, for the application that has not been deployed to cloud managed services it is necessary for us to configure the monitoring tools ourselves. An example of such a deployment may be an application deployment to on-premises resources (such as a set of servers in an in-house data centre) or an application deployed to a set of virtual machines in the cloud.

The technology provided by Microsoft for such a task is ‘System Center Operations Manager’ (SCOM). We have recently configured version ‘2012’ to monitor an enterprise application – with good results. During this process we have formed the impression that the documentation currently unfortunately fails to address certain points, as we have been obliged to find the answers to various questions through our own experimentation.

The primary source of documentation that we have used has been ‘System Center 2012 Operations Manager Unleashed 2012’ by Kerrie Meyler and Cameron Fuller. Whilst it can be said that this is a generally well written book, we have found that certain essential pieces of guidance seem to be missing. I would recommend the use this book to provide the fundamental knowledge required. However, we have undertaken to write this BLOG so as to provide answers to the outstanding questions. This BLOG does not attempt to replace the book, as it covers nowhere near the breadth of scope. However, the BLOG should provide you with the essence of the fundamentals required for the specific case of configuring the technology to monitor an ASP.Net application (from the perspective of the server). More specialised or elaborate monitoring scenarios may be setup (these are outside of the scope of this BLOG).

The assumption has been made that SCOM 2012 has been installed on a server residing in the same Active Directory domain as the server(s) to be monitored. Please ensure that the management pack ‘.NET Application Performance Monitoring’ (APM) has been installed, as this will be essential to the following sections.

Basic Configuration of the Monitoring Agents

With the way that we intend to use SCOM 2012, monitoring agents will be deployed to each target server. The monitoring agents will be used to collect the health and performance data that we will be analysing.

To deploy or manage the agents, open Operations Console and navigate to Administration / Device Management / Agent Managed on the menu. The grid in the central section of the screen should list the agents currently deployed. If the server in question does not appear in the list, use the ‘Discover Wizard’ to search for it and add it to the list. The wizard may be found by opening the context menu on the ‘Agent Managed’ node.

Once added, your agent should appear with a green (healthy) tick against it in the grid. If the tick appear in grey, it may be necessary to invoke ‘Repair’ by opening the context menu on the row that corresponds with the agent in the grid.

The installed agent should appear as two Windows Services with the names below on the target server:

  • Microsoft Monitoring Agent
  • Microsoft Monitoring Agent APM

Configuration of the Monitor

Please read chapter 15 ‘Monitoring .NET Applications’ of the text book referred to above for an overview of the process.

To configure the APM monitor, navigate to Authoring / Management Pack Templates / .NET Application Performance Monitoring

Select ‘Add Monitoring Wizard’. Follow the steps detailed in the above chapter of the book to configure the new monitor.

Note that the ‘Performance event threshold’ figure will need to be finely tuned over time in order strike the correct balance between over and under-reporting events.

Analysing System Performance Alerts

With the monitor configured, any system performance alerts that are recorded will be accessible under the following menu item:

Monitoring / Application Monitoring / .NET Monitoring / <monitor name> / <application name> / Overall Component Health

The individual alert may be selected, with the details shown at the foot of the screen.

Automatic notifications of alerts may be configured so that the details can be delivered via a medium such as email to the relevant addresses.

Reporting System Load Measurements

With the monitor configured, it will be possible to access data pertaining to system load levels via the following menu item:

Monitoring / Application Monitoring / .NET Monitoring / <monitor name> / <application name> / All Performance Data

Select the required counter, we recommend ‘Monitored requests per sec’.

Measuring System Response Times

In order to reliably periodically measure the response times of a web application, it is necessary to configure SCOM 2012 to play a defined web session repeatedly on a scheduled basis. In our case, the web session that was recorded included the following steps:

  • Login to the application
  • Navigate to a particular search function
  • Perform the search
  • Logout of the application

SCOM 2012 was configured to play the above steps every two minutes, and to record the overall time taken.

Please read chapter 17 ‘Using Synthetic Transactions’ of the text book referred to above for an overview of the process.

Follow these steps for the configuration:

  1. Record the web session

Navigate to Authoring / Management Pack Templates / Web Application Transaction Monitoring

Invoke ‘Add Monitoring Wizard’

Select ‘Web Application Transaction Monitoring’, click ‘Next’

Enter a name for the web application, and select ‘Default Management Pack’, click ‘Next’

Enter the URL of the web application, click ‘Next’

Select the server upon which the process will be executed (we recommend selecting the server that SCOM 2012 is running on), click ‘Next’

Select ‘Configure advanced options or record a browser session’, click ‘Create’

Select ‘Start Capture’

At this point, the default browser should appear with the ‘Web Recorder’ plug-in visible and running (on the left of the window). If the Web Recorder is not present, then

  1. You may need to temporarily disable ‘IE Enhanced Security Configuration’ (if using Internet Explorer on a server). Follow this article for details on how to do this.
  2. You may also need to make SCOM 2012 open the correct version (32 bit or 64 bit) of IE. Follow this article for details on how to do this.

Record the web session, and then click ‘Stop’

2. Adjusting the recorded web session to operate with the authentication mechanism of your website

If your website utilises Active Directory authentication, then follow the steps in the previously referenced chapter 17 to configure this.

If (as in our case), your website uses Forms Authentication, then you will need to follow the additional configuration steps below:

You will need to add to your web application a method by which to obtain the session and authentication IDs. In the case of our ASP.Net MVC application (that holds these IDs in a cookie), we added a new Action Method (as shown below):