Menu Close

Part 8: Use VSAE fragments to create a Windows Performance Monitor with Consecutive Samples

This is Part 8 in a series of posts described here:

In our next example fragment – we will create Monitor for Windows Performance for our MP.


Step 1:  Download and extract the sample MP fragments.  These are available here:

I will update these often as I enhance and add new ones, so check back often for new versions.

Step 2:  Open your newly created MP solution, and open Solution Explorer.  This solution was created in Part 1, and the class was created in Part 2.

Step 3:  Create a folder and add the fragment to it.

Create a folder called “Monitors” in your MP, if you don’t already have this folder.



Right click Monitors, and Add > Existing item.

Find the fragment named “Monitor.Performance.ConsecSamples.TwoState.mpx” and add it.

Select Monitor.Performance.ConsecSamples.TwoState.mpx in solution explorer to display the XML.


Step 4:  Find and Replace

Replace ##CompanyID## with our company ID which is “Fab

Replace ##AppName## with our App ID, which is “DemoApp

Replace ##ClassID## with the custom class we created in Part 2 of the series.  This was “Fab.DemoApp.Server.Class” from our previous class fragment.

Replaced ##UniqueID## with something unique for this monitor, such as “TotalJobsPrinted

Replace ##ObjectName## with a valid perfmon object.  I will use “Print Queue

Replace ##CounterName## with a valid perfmon counter.  I will use “Total Jobs Printed

Replace ##InstanceName## with a valid perfmon instance.  I will use “_Total

Replace ##FrequencySeconds## with a valid interval for performance monitoring, typically 60 seconds for a monitor.

Replace ##Threshold## with a valid threshold for the monitor.  I will use “5

Replace ##Samples## with how many consecutive samples you want over the threshold before changing monitor state.  I will generally set this to 2 for all monitors, unless I want to control noise with longer sample counts.


That took all of 2 minutes.  Take another few minutes to review the XML we have in this fragment.  It is a simple monitor definition, it checks every minute, and when 2 consecutive samples are over a threshold value of “5”, it will change state and alert. 


Step 5:  Save and Build the MP.   BUILD > Build Solution.



Step 6:  Import or Deploy the management pack.



Step 7:  Test the MP.

Open the Monitoring pane of the console – and find your folder you created in Part 6.

Open the state view.

Open Health Explorer for an instance of your class.



To test this perf counter, you can print dummy jobs from Notepad to the Microsoft XPS document writer, to get the value over the threshold.

After 5 consecutive samples, based on our interval (every 60 seconds) I should see a statechange after 2 minutes.








Leave a Reply

Your email address will not be published.