How to repair MSMQ Performance Counters


At last, after years of waiting, there is finally a KB article on repairing the MSMQ Performance Counters:


936493 Performance objects or bridge channel data may not appear as expected in Message Queuing


There are already a number of KB articles that discuss fixing counter problems but they are usually service-specific. Not having one dedicated to MSMQ may have put people off trying the steps which is a shame as all the techniques can be applied to any broken counter.


There are basically two scenarios where you don’t see the counters you expect:



  1. All the MSMQ objects are there (MSMQ Queue, MSMQ Service, MSMQ Session) but a particular queue is not showing up

  2. None of the MSMQ objects are there.

The first is easy enough – MSMQ only generates performance data for active queues. That is, those queues that contain at least one message or are held open by a currently running application. There is no point creating memory structures for queues that exist but are never used.


The second has three causes:



  1. The MSMQ service isn’t running (which hopefully you will have checked already)

  2. The MSMQ performance counters are disabled (which would be the case if HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\MSMQ\Performance\Disable Performance Counters=1; see 248993 PRB: Performance Object Is Not Displayed in Performance Monitor)

  3. The MSMQ performance counters are corrupt. (This is where the KB article helps most).

First place to check for problems is the event log where you can expect to see the following event if the counters are broken:


Event Type: Error
Event Source: Perflib
Event Category: None
Event ID: 1008
Date: 1/14/2007
Time: 1:06:01 PM
User: N/A
Computer: MSMQSERVER
Description:
The Open Procedure for service “MSMQ” in DLL “C:\WINNT\system32\MQPERF.DLL” failed.
Performance data for this service will not be available. Status code returned is
data DWORD 0.
Data:
0000: 00000002 


You can find documentation for this event here: 226494 Events for Performance Monitor extensions



Then you need to follow the methods in the KB.


Method 1” discusses checking the HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\MSMQ\Performance registry key for the required values. The values are very important as they position the MSMQ counters in the long list of counters and help texts that PerfLib maintains – if the number sequence is broken or invalid then counters stop working.


Method 2” talks about using the LODCTR and UNLODCTR command-line utilities to reload the broken counters. There is more documentation here for this approach: 226512 HOW TO: Reinstall IIS 4.0 Performance Monitor Counters.


Method 3” sort of combines the 2 above. Give this KB article a read: 300956 How to manually rebuild performance counter library values


There is another utility which the article doesn’t cover – the Extensible Performance Counter List tool which comes with the Windows 2000 Resource Kit and can be downloaded from here. This can be used to disable and re-enable counters (which may help).


Reference Material 


152513 Troubleshooting Performance Monitor Counter Problems
179456 Extensible Counters in Performance Monitor
226494 Events for Performance Monitor extensions
226512 HOW TO: Reinstall IIS 4.0 Performance Monitor Counters
248993 PRB: Performance Object Is Not Displayed in Performance Monitor
249138 Controlling the disabling of Performance Monitor extensions
300956 How to manually rebuild performance counter library values

Comments (3)

  1. mike bilsborough says:

    Hi,

    The issue we have seen a few times in that the perf counters correctly reflect what MSMQ is showing on the queue but in fact MSMQ is wrong. ie when you get it to list the queues, it shows the total number of items for each queue and that is wrong.  if we then look at the items on the queue itself that doesn’t match.

  2. MSDNArchive says:

    Hi Mike,

    Good to hear from you again.

    In your scenario, are you comparing the numbers returned by Performance Monitor with the data shown in the "Number of messages" column in Computer Management?

    As I understand it, Performance Monitor queries the performance data that MSMQ generates whereas Computer Management looks at the queues themselves although in theory both should have the same numbers.

    How different are the values you are seeing?

  3. If you have the MSMQ service up and running but all of the following classes are missing: Win32_PerfRawdata_MSMQ_MSMQQueue