Monitoring Microsoft Exchange message queues with Windows performance counters
This article explains how Windows performance counters are collected by Checkmk and how to use them to discover additional Microsoft Exchange message queues.
LAST TESTED ON CHECKMK 2.5.0P7
Table of Contents
Background
Checkmk includes several predefined check plug-ins that read Windows performance counters through WMI.
Existing plug-ins already collect most of the performance counters required by Checkmk. Adding a custom performance counter does not automatically create a new monitored service. Checkmk also requires a compatible check plug-in that can interpret the collected data.
For Microsoft Exchange, the winperf_msx_queues plug-in processes queue information collected from the MSExchangeTransport Queues performance-counter object.
By default, the plug-in discovers only a predefined selection of Exchange queues. Additional queues must be configured manually.
Problem
When you configure the Queue names rule, the winperf_msx_queues check plug-in stops using its built-in default queue list.
After the rule has been created, winperf_msx_queues monitors only the queues explicitly configured in the rule.
Therefore, you must add:
Every default queue that you want to continue monitoring
Every additional queue that you want to discover
Prerequisites
Before continuing, make sure that:
The Windows agent is installed on the Exchange server.
The Agent Bakery is available.
The Exchange performance-counter object exists on the monitored server.
You have permission to run an elevated Command Prompt on the Exchange server.
Find the available Exchange queues
To configure an additional queue, you need:
The queue name
The queue offset
Both values can be obtained from the Windows performance-counter database.
Export the performance counters
Open an elevated Command Prompt on the Exchange server and run:
lodctr /s:counters.iniThis exports all Windows performance counters into a file named counters.ini.
The file is normally created in the current working directory.
Locate the Exchange Transport counter object
Open counters.ini and search for:
MSExchangeTransport Queues
An example section may look similar to this:
390022=MSExchangeTransport Queues
390023=Performance counters...
390024=External Active Remote Delivery Queue Length
390026=Internal Active Remote Delivery Queue Length
390028=External Retry Remote Delivery Queue Length
390030=Internal Retry Remote Delivery Queue Length
390032=Active Mailbox Delivery Queue LengthThe numerical identifiers may differ between Windows or Exchange installations. Always use the values from the monitored Exchange server.
Configure the performance-counter collection
Create the bakery rule
In the Checkmk interface, open:
Setup > Agents > Windows, Linux, Solaris, AIX > Agent rules > Windows Performance-Counter objects
Create a rule with the following values:
Setting | Value |
|---|---|
Section name |
|
Counter object |
|
Apply the rule to the required Exchange host or hosts.
Bake and install the agent
After saving the rule:
Bake a new agent.
Sign the agent package, when agent signing is enabled.
Install the updated agent on the Exchange server.
The new agent configuration instructs the Windows agent to collect the MSExchangeTransport Queues performance-counter object.
Calculate the queue offset
The queue offset is calculated using the following formula:
Queue Offset = Queue Counter ID − MSExchangeTransport Queues Counter ID
Example: External Active Remote Delivery Queue Length
Using the example values:
MSExchangeTransport Queues = 390022
External Active Remote Delivery Queue Length = 390024
Calculate the offset:
390024 − 390022 = 2
The queue offset is 2.
Only the even offset numbers will be possible to use.
Example: Submission Queue Length
Suppose you want to monitor Submission Queue Length.
Locate the queue in counters.ini:
390088=Submission Queue Length
Using the same performance-counter object ID:
390088 − 390022 = 66
The resulting configuration is:
Queue | Offset |
|---|---|
Submission Queue Length | 66 |
Configure the Queue names rule
Open the Queue names rule and add every queue you want to monitor.
For example:
Queue | Offset |
|---|---|
Active Remote Delivery | 2 |
Retry Remote Delivery | 6 |
Active Mailbox Delivery | 10 |
Poison Queue Length | 58 |
Submission Queue Length | 66 |
Apply the rule to the required Exchange host or hosts.
Remember that once this rule is configured, you must explicitly add every queue you want to monitor, including the default queues. The plugin no longer adds the default queues automatically.
Activate the changes and rediscover the services
After saving the rule:
Activate the pending changes.
Open the Exchange host.
Run a service discovery on the Exchange host.
Verify that all configured queues appear as services.
Accept the newly discovered queue services.
Confirm that both the default queues and any newly added queues are being monitored.
Validation
Verify the following:
The
msx_queuessection is present in the agent output.All configured queues appear during service discovery.
The discovered queue names match the names configured in the rule.
Both the required default queues and additional queues are monitored.
The services return current queue-length values.
You can inspect the agent output from the Checkmk server with:
cmk -d <exchange_host>
To display only the relevant section, use:
cmk -d <exchange_host> | sed -n '/<<<msx_queues/,/^<<<.*>>>/p'
Troubleshooting
The queues do not appear during service discovery
Check the following:
The Windows Performance-Counter objects rule is assigned to the correct host.
The section name is exactly
msx_queues.The counter object is exactly
MSExchangeTransport Queues.The updated agent has been baked and installed.
The changes have been activated.
The queue name and offset are correct.
The offset is an even number.
Every required queue has been added to the Queue names rule.
The msx_queues section is missing
Confirm that the Exchange server exposes the required performance-counter object.
Run the following command on the Exchange server:
typeperf -qx | findstr /i "MSExchangeTransport Queues"Also confirm that the installed agent contains the configuration generated by the bakery rule.
Default queue services disappear
This is expected when a Queue names rule has been configured without including the original default queues.
Edit the rule and add every default queue that should remain monitored.
The offset produces the wrong queue
Export counters.ini again directly on the affected Exchange server and recalculate the offset using the IDs from that system.
Do not reuse counter IDs from another Windows or Exchange server because the numerical IDs can differ.
Using other Windows performance counters
The same general collection method can also be used for other Windows performance-counter objects:
Identify the required performance-counter object.
Configure it through the Windows Performance-Counter objects bakery rule.
Bake and install the updated agent.
Confirm that the section appears in the agent output.
Use or create a compatible Checkmk check plug-in to parse the data.
Collecting a performance counter alone does not create a Checkmk service. A suitable check plug-in is still required to interpret the counter values.