Tweaking Microsoft Monitoring Agent for Null Values

Larry Guger

The Microsoft Monitoring Agent does a great job of logging unexpected exceptions that occur within your application. NullReferenceExceptions are one of the most frequent types of exceptions that are encountered. The default settings for the Microsoft Monitoring Agent are configured to optimize data collection and does not record null parameter values. Understanding which parameter values were null can be key to resolving NullReferenceExceptions. If you are seeing those types of exceptions with you applications you may want to tweak the configuration settings of the Microsoft Monitoring Agent to include null parameters.

The file that you need to modify is named PMonitor.config. If you are using the standalone installation you will find this file in the following location (note that the location will be different for a System Center managed installation):

%PROGRAMFILES%/Microsoft Monitoring Agent/Agent/APMDOTNETAgent/V7.1.10184.0/DefaultConfiguration

where %PROGRAMFILES% will be either “Program Files” or “Program Files (x86)” depending on whether you have a 32 bit or 64 bit version of the operating system installed and whether it is the 32 bit or 64 bit version of the Microsoft Monitoring Agent. The version number reflects the version of the release as of October 2013, your version number may be higher.

Once you have located the PMonitor.config file, open it using your favorite XML editor. You need to add a single line <ss:emptyObjects print=”true” /> into the file as shown below.

clip_image001

Once you have modified the configuration file any application that you monitor will include null values as part of the data capture. Below are two screenshots from Visual Studio Ultimate showing the difference.  The first one shows data collected without this setting and the second shows data collected with the additional setting.

clip_image002

clip_image003

With the modification you can easily identify the null parameter value that caused the exception. It should be noted that parameter collection is still capped at the first 20 parameters so if you have a particularly large number of parameters some of them may be missed.

If you have any feedback we would love to hear it in the comments below or in our MSDN forum.

0 comments

Discussion is closed.

Feedback usabilla icon