# Exchange 2010 mail queues size check V1.0 # Dmitry Vayntrub 05/06/2011 # # To use with NSClient++ : # #[NRPE Handlers] #command[check_mail_queu=cmd] /c echo C:\Scripts\Nagios\check_mail_queue.ps1 | PowerShell.exe -Command - # # On the check_nrpe command include the -t 30, since it takes some time to load # the Exchange cmdlet's. Add-PSSnapin Microsoft.Exchange.Management.PowerShell.E2010 if ($NagiosDescription=Get-TransportServer | Get-Queue -Filter {MessageCount -gt 1000}) {Write-output "CRITICAL: " $NagiosDescription exit 2} elseif ($NagiosDescription=Get-TransportServer | Get-Queue -Filter {MessageCount -gt 500}) {Write-output "WARNING: " $NagiosDescription exit 1} else {Write-Host "OK: All mail queues within limits." exit 0}