Member_2_6474242
asked on
Ms exchange 2010 high queue alert
Ms exchange 2010 high queue alert. What can i do on exchange 2010 so that i can get alerts when it reaches more then 10 messages in queue
What is the best practice?
What is the best practice?
ASKER
Thanks MAS EE MVE
Can you please clarify. It is only connecting VERBOSE. Is that ok. This will only work when there is a queue right.
give a warning. the names of some imported commands from the module 'tmp_npo44qgd.154' include unapproved verbs that might make them less discover-able. to find the commands with unimproved verbs, run the import module command again with the verbose parameter. for a list of approved verbs, type Get-verb
i have attached error message
Please note i am a beginner in powershell
erroronqueuestats.txt
Can you please clarify. It is only connecting VERBOSE. Is that ok. This will only work when there is a queue right.
give a warning. the names of some imported commands from the module 'tmp_npo44qgd.154' include unapproved verbs that might make them less discover-able. to find the commands with unimproved verbs, run the import module command again with the verbose parameter. for a list of approved verbs, type Get-verb
i have attached error message
Please note i am a beginner in powershell
erroronqueuestats.txt
You can try to use the below script which you can also customize it yourself:
$Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri http://YourExchangeServer.domain.com/PowerShell/ -Authentication Kerberos
Import-PSSession $Session -AllowClobber
Import-Module ActiveDirectory -ErrorAction STOP
While ($true) {
$Queue = Get-TransportServer |
ForEach-Object {Get-Queue -Server $_} |
Where-Object {($_.MessageCount -gt 0) -and ($_.Identity -notlike "*\Poison") -and ($_.Identity -notlike"*\Shadow\*")} |
Select-Object Identity, Status, MessageCount, NextHopDomain
$QueueLength = $Queue | Measure-Object MessageCount -Sum | Select-Object -ExpandProperty Sum
"[$(Get-Date -Format 'yyyy-MM-dd hh:mm:ss')] Queues found: $($Queue.Count); messages: $($QueueLength)." | Write-Host -ForegroundColor White
$Subject = ''
If ($QueueLength -gt 200) {
$Subject = "Attention Critical Exchange Queue Alert Total Message Queue $QueueLength"
$Color = 'Red'
} ElseIf ($QueueLength -gt 100) {
$Subject = "Attention Warning Exchange Queue Alert Total Message Queue $QueueLength"
$Color = 'Yellow'
} ElseIf ($QueueLength -gt 10) {
$Subject = "Attention Informational Exchange Queue Alert Total Message Queue $QueueLength"
$Color = 'White'
}
If ([string]::IsNullOrEmpty($Subject)) {
"[$(Get-Date -Format 'yyyy-MM-dd hh:mm:ss')] Exchange is pretty much idle ..." | Write-Host -ForegroundColor Green
} Else {
"[$(Get-Date -Format 'yyyy-MM-dd hh:mm:ss')] $($Subject)" | Write-Host -ForegroundColor $Color
Send-MailMessage `
-Subject $Subject `
-Body $($Queue | ConvertTo-HTML | Out-String) `
-From "Powershell@domain.com" `
-To "Admin@domain.com" `
-SmtpServer "smtp.domain.com" `
-BodyAsHtml
}
Start-Sleep -Seconds 120
}
I advise you to review your threshold requirement. 10 mails is too low for any mail server. I will set alert, if anything goes about 150-200. Rest, you have tons of script or tools to get the alert. However, remember, if your Exchange server itself having issues, you won't get the alert. Better to use 3rd party tool to monitor your server.
ASKER
what are some of the tools that can be used for this purpose?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
thanks
Please find below script to send email when it reaches threshold of 10.
Open in new window