Partager via


Exchange Message Queue Monitoring

Q ?

Hopefully something else popped into your mind, not Star Trek - The Next Generation

 

 

How about monitoring a message queue?

 

 

This will help you monitor specifically Exchange 2013-2016 queue changes (state or message count beyond a value)

 

Just specify the queue and encapsulate into a monitor

OR... download the MP Fragment here

############################################################

# Test Queues

#Lab environment

#$queue1 = "Submission"
#$queue2 = "Submission2"

$queue1 = "CompanyName365-mail-onmicrosoft-com.mail.protection.outlook.com"
              $queue2 = "clustered.testlab.net"

##################################################################
# 1. How to monitor the status of the queues below (when the status is "retry" they need alert)

$SPEvent = ( get-queue | where { $_.NextHopDomain -like "$queue1" } | where { $_.Status -like "Retry" } | measure-object )
$SPEvent2 = ( get-queue | where { $_.NextHopDomain -like "$queue2" } | where { $_.Status -like "Retry" } | measure-object )

#
# 2. To get an alert when a message in any of these queues is stuck for > 5minutes
#

$SPEventStuck = ( get-queue | where { $_.NextHopDomain -like $queue1 } | where { $_.Status -like "Suspended" } | measure-object )
$SPEventStuck2 = ( get-queue | where { $_.NextHopDomain -like $queue2 } | where { $_.Status -like "Suspended" } | measure-object )

# 3. Also need alert and exact count when the message count in the above queue goes beyond 1000

$SPEventMC = ( get-queue | where { $_.NextHopDomain -like $queue1 } | where { $_.MessageCount -gt 1000 } | measure-object )
$MCQ1 = ( get-queue | where { $_.NextHopDomain -like $queue1 } )
$MQ1 = ($MCQ1.MessageCount)

$SPEventMC2 = ( get-queue | where { $_.NextHopDomain -like $queue2 } | where { $_.MessageCount -gt 1000 } | measure-object )
$MCQ2 = ( get-queue | where { $_.NextHopDomain -like $queue2 } )
$MQ2 = ($MCQ2.MessageCount)

 

 

Have fun!