Lync server 2010 – Monitoring Messages in Server

Hi Readers,

Recently We have faced issues with Lync performance, IM messages were getting delayed, some times Users were not able to Join meetings, some time connection to Lync was taking too much time.

On troubleshooting we have found that Messages in Server value on front-end server & other servers is going beyond limits ( 4000 –8000 ).

Capture1

On further working on this issue it was found that edge servers are looping messages to internal Lync servers, as soon as we stopped the edge services, Messages in server value has gone below 30..

You can also see messages in server value by using Get-CsWindowsService

Capture2

Till the time we resolve this issue , We came up with a workaround script to monitor this value.

Extract the zip file from below link, change the values accordingly and schedule the batch file to get alerts if value is above threshold.

https://gallery.technet.microsoft.com/scriptcenter/Lync-server-2010-Messages-be8b04e8

$threshold = “100”

$fromadd = “Monitoring@labtest.com”

$email1=”Vikassukhija@labtest.com”

$smtpServer=”smtpserver”
$server_list=@(“serverDRP01″,”serverDRP02″,”serverFEP01″,”serverFEP02″,”serverFEP03”)

if you run it manually than it will show the result as below:

Lynccap

#################################################################### 
#       Author: Vikas Sukhija 
#    Reviewer: 
#       Date: 05/08/2015 
#    Update:  
#       Description: Monitoring Lync "Messages in server" 
#    If its go beyound threshold, Critical alert is generated 
#################################################################### 
 
Import-Module 'C:\Program Files\Common Files\Microsoft Lync Server 2010\Modules\Lync\Lync.psd1' 
 
$threshold = "100" 
 
$fromadd = “Monitoring@labtest.com” 
$email1=”Vikassukhija@labtest.com” 
$smtpServer="smtpserver" 
 
$server_list=@("serverDRP01""serverDRP02""serverFEP01""serverFEP02""serverFEP03") 
 
$server_list | foreach-object { 
 
$computern = $_ 
 
Write-host "processing ..............$computern" -foregroundcolor blue 
 
$csstatus = Get-CsWindowsService -computerName $computern 
 
$rtcsrvst = $csstatus | where{$_.Name -like "RTCSRV"} 
 
$activitylevel = $rtcsrvst.activitylevel 
 
$activitylevel1 = $activitylevel.split("=") 
 
$activitylevel2 = $activitylevel1[2].split(",") 
 
$alevel = $activitylevel2[0] 
 
if([int]$alevel -ge $threshold) { 
 
Write-host "Messages in Server $computern is $alevel" -foregroundcolor Red 
 
$msg = new-object Net.Mail.MailMessage 
$smtp = new-object Net.Mail.SmtpClient($smtpServer) 
 
#Mail sender 
$msg.From = $fromadd 
#mail recipient 
$msg.To.Add($email1$msg.Subject = "Event Notification : OPEN CRITICAL : Messages in Server $computern is above $threshold" 
$msg.Body = "Service $process  has been restarted on $host1" 
$smtp.Send($msg) 
} 
else { 
 
Write-host "Messages in Server $computern is $alevel" -foregroundcolor green 
 
} 
 
} 
 
############################################################################

Regards

Sukhija Vikas

http://msexchange.me

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s