Monitor Exchange Transport Queue with PRTG

So if you don’t know about it or are looking for something, PRTG is a great and powerful network monitoring tool. I’d recommend checking it out. There’s a free trial and you can start getting details of your network in just a few short minutes thanks to their super easy setup and configuration.

Now I’m not going to review PRTG because I’m sure there’s plenty of reviews already out there, but simply put they have built-in monitors/sensors that are preconfigured for what you want to monitor. Should these built-in sensors not be adequate, they have the custom external sensor. Basically, this custom sensor allows you to use your own application or script to return text or XML data back to PRTG to log and report on.

That’s what this is about. A script that will monitor Exchange 2010’s transport queue and output the results to XML and set a warning based on the total count of emails in the queue. You can setup your own alerting of this sensor to email you when the “queue fills up”.

Simply put this bat/ps1 file in the EXEXML directory on your probe/server and add a new EXEXML sensor. Select the bat file and change your preferences.

Batch File (get-transport-queue.bat):

PowerShell File (get-transport-queue.bat):

Some items worth noting:

  • The powershell and batch file must be named the same thing to run, otherwise you’ll need to change the path to the PowerShell script in the Batch file.
  • The batch and powershell require one argument, the server you wish to monitor. Since the custom sensor is linked to a device it will/should only monitor that specific device/server.
  • I found some issues where the PowerShell didn’t terminate on the remote servers so I added the function to kill the session over again.

That’s pretty much it. If you don’t care about reporting/logging the other queue’s you can remove the foreach loop and only monitor the total transport queue size.

Leave a Reply

Your email address will not be published. Required fields are marked *