Hi all,
I'd like to share the results of the research I've done on how to monitor Lync online users, Lync Inbound Calls and Lync Outbound Calls.
On the internet I've found a Powershell script, which I have modified to monitor the inbound and outbound calls.
Here are the scripts. To use the script in PRTG you have to do the following:
- Copy powershell.exe on the probe from c:\windows\system32\windowspowershell\* to the EXE/XML directory in c:\program files (x86)\PRTG Network Monitor\Custom Sensors
- Copy the script as a .ps1 file in c:\batch on the probe
- Create an EXE/ADVANCED script in PRTG
- Select powershell.exe
- Enter parameters: -noprofile -executionpolicy bypass -file c:\batch\prtg-lyncuser.ps1 (or your script)
- Set security context to Use Windows credentials of parent device
Script to monitor Lync Online Users:
# prtg-lyncuser.ps1 # # Loading current sip client connections as performance counter # param ( [string]$server= "YOUR LYNC FE SERVER, YOUR SECOND LYNC FE SERVER(OPTIONAL), YOUR THIRD LYNC FE SERVER(OPTIONAL)" # specify Servers ) write-host "Start PRTG Sensor" write-host "Server:" $Server $serverlist = $server.split(",") write-host "Serverlist count:" $Serverlist.count $result="<prtg>`r`n" foreach ($server in $serverlist){ write-host "Server: " $server $value = (Get-Counter "\LS:SIP - Peers(Clients)\SIP - Connections Active" -ComputerName $server -ErrorAction silentlycontinue) if ($error) { # Skip Counters write-host "Server: $server Unable to read $counter" $error.clear() } else { $result+=" <result>`r`n" $result+=" <channel>SIPClients("+$server+")</channel>`r`n" $result+=" <value>"+$value.CounterSamples[0].CookedValue+"</value>`r`n" $result+=" <unit>Count</unit>`r`n" $result+=" <mode>Absolute</mode>`r`n" $result+=" </result>`r`n" } } $result+="<text>LyncUsers:"+$arg+"</text>`r`n" $result+="</prtg>" write-host "End: ExitCode "$error.count Write-host "Sending Result to output pipeline" $result if ($error) { #write-host "Found Errors" EXIT 1 }
Script to monitor Inbound calls:
# prtg-lynccallsin.ps1 # # Loading current sip client connections as performance counter # param ( [string]$server= "YOUR LYNC FE SERVER, YOUR SECOND LYNC FE SERVER(OPTIONAL), YOUR THIRD LYNC FE SERVER(OPTIONAL)" # specify Servers ) write-host "Start PRTG Sensor" write-host "Server:" $Server $serverlist = $server.split(",") write-host "Serverlist count:" $Serverlist.count $result="<prtg>`r`n" foreach ($server in $serverlist){ write-host "Server: " $server $value = (Get-Counter -ComputerName $server -Counter "\LS:MediationServer - Inbound Calls(_Total)\- Current" -ErrorAction silentlycontinue) if ($error) { # Skip Counters write-host "Server: $server Unable to read $counter" $error.clear() } else { $result+=" <result>`r`n" $result+=" <channel>Inbound Calls("+$server+")</channel>`r`n" $result+=" <value>"+$value.CounterSamples[0].CookedValue+"</value>`r`n" $result+=" <unit>Count</unit>`r`n" $result+=" <mode>Absolute</mode>`r`n" $result+=" </result>`r`n" } } $result+="<text>Calls:"+$arg+"</text>`r`n" $result+="</prtg>" write-host "End: ExitCode "$error.count Write-host "Sending Result to output pipeline" $result if ($error) { #write-host "Found Errors" EXIT 1 }
Script to monitor outbound calls:
# prtg-lyncuser.ps1 # # Loading current sip client connections as performance counter # param ( [string]$server= "YOUR LYNC FE SERVER, YOUR SECOND LYNC FE SERVER(OPTIONAL), YOUR THIRD LYNC FE SERVER(OPTIONAL)" # specify Servers ) write-host "Start PRTG Sensor" write-host "Server:" $Server $serverlist = $server.split(",") write-host "Serverlist count:" $Serverlist.count $result="<prtg>`r`n" foreach ($server in $serverlist){ write-host "Server: " $server $value = (Get-Counter -ComputerName $server -Counter "\LS:MediationServer - Outbound Calls(_Total)\- Current" -ErrorAction silentlycontinue) if ($error) { # Skip Counters write-host "Server: $server Unable to read $counter" $error.clear() } else { $result+=" <result>`r`n" $result+=" <channel>Outbound Calls("+$server+")</channel>`r`n" $result+=" <value>"+$value.CounterSamples[0].CookedValue+"</value>`r`n" $result+=" <unit>Count</unit>`r`n" $result+=" <mode>Absolute</mode>`r`n" $result+=" </result>`r`n" } } $result+="<text>Calls:"+$arg+"</text>`r`n" $result+="</prtg>" write-host "End: ExitCode "$error.count Write-host "Sending Result to output pipeline" $result if ($error) { #write-host "Found Errors" EXIT 1 }
It's working seamlessly on our systems in PRTG.
Add comment