«

»

Feb 04 2012

Unofficial VMware View PCoIP Adapter for VCOps

VMware View adapter for vCenter Operations is close to GA date. That’s is fantastic; and it will give VMware View administrators the long waited insight on what’s happening with the virtual desktops and virtual desktop infrastructure.

VMware View adapter will provide several metrics. However, the adapter utilize WMI calls available in VMware View 5.0 to post PCoIP data to VCOps. Like many of my customers, you may not be in a position to upgrade to View 5.0, but still want to get the PCoIP statistics in real time. Optionally, you may want to feed different data management system such as Splunk.

The script below I created to address this problem.

This PowerShell script should be executed in a Connection Server and no additional components are required (there is an option to run against vCenter server). The script will execute a loop to read specific parts of the PCoIP server log file for each virtual desktop with active PCoIP remote session.

After collecting the PCoIP data the script leverage another incredible piece of work from Clint Kitson @clintonkitson and Matt Cowger @mcowger  (https://community.emc.com/thread/130486) to post the data to VCOps.

The screenshot below demonstrate how you see the PCoIP data after the collection and post. The metrics available for each virtual desktop are:

  • Audio (bytes)
  • Avg RX (KBytes/s)
  • Avg TX (KBytes/s)
  • Bandwidth Limit (KBytes/s)
  • Loss RX (%)
  • Loss TX (%)
  • Plateau (KBytes/s)
  • Round Trip Time (ms)
  • RTO
  • Variance
  • FPS [Added 2/6/2012]

image

Follow the steps below to configure your vCenter Operations 5.0 Dashboard:

Note – VCOps will required the Enterprise License to allow Custom mode access.

  1. Go to https://ip-address/vcops-custom
  2. Click on ‘+’ symbol to add a new dashboard and give it a Tab name.
  3. Select and add the ‘Metric Graph’ template.
  4. Remote the TAG SELECTOR widget.
  5. Edit RESOURCE SELECTOR widget and select Adapter Kind “ps_vcops_httppost”.
  6. Select Filter By Health Status = Good
  7. Select Collection Status = Collecting and Save

If the script has been running for a little while at this point you should see virtual desktops with active PCoIP sessions on the RESOURCE SELECTOR widget. When you select a resource desktop you will see the metrics available on Metric Selector widget.

Select the metric you want to watch in real-time and click “Move to Graph”.

image

Voila! You should start to see to see the data in real-time.

Tips:

  • Change the refresh Interval at ‘METRIC GRAPH’ widget to the same interval on the script.
  • Enable Auto Refresh on  ‘METRIC GRAPH’ widget.
  • Select Zoom All Graphs to interact with all graphs simultaneously.
  • Test-Drive the tool comparing same metrics for different desktop at same time.

[css lang=”plain” autolinks=”false” classname=”myclass” collapse=”false” firstline=”1″ padlinenumbers=”false” gutter=”true” smarttabs=”true” tabsize=”10″ toolbar=”true”]

#####
#
# 09/30/2011
# Andre Leibovici – @andreleibovici – myvirtualcloud.net
#
# get_pcoip_stats.ps1 – retrieve pcoip log stats from virtual desktops with active sessions and pipeline to VMware vCOps through a builtin HTTPOST adapter
#
# PARAMETERS
# -viserver = the IP/hostname of the vCenter server (optional)
# -username = username for vCenter (optional)
# -password = password for vCenter (optional)
# -vcopsuser = username for vcops user tha will be posting (default blank)
# -vcopspass = password for vcops user (default blank)
# -vcopsip = the IP/hostname of the vCOps server running the HTTPOST adapter
# -sleeptime = time in seconds between checking PCoIP logs for all virtual desktops (default = 20)
#
# EXAMPLE
# .\ps_get_pcoip_stats.ps1 -vcopsip 192.168.2.24 -vcopsuser "admin" -vcopspass "password" -sleeptime 10
# .\ps_get_pcoip_stats.ps1 -viserver 192.168.2.5 -username "lab\administrator" -password "password" -vcopsip 192.168.2.24 -vcopsuser "admin" -vcopspass "password" -sleeptime 50
#
#
# Updates
# 2/6/2012 – Added ICMP checking
# 2/6/2012 – Added FPS metric
#
#####

Param ($viserver="", $username="", $password="", $vcopsip, $vcopsuser, $vcopspass, $sleeptime="20")

if((!$vcopsip -or !$vcopsuser -or !$vcopspass)) {
write "Missing Parameters";exit
}

function connect_vi {
Connect-VIServer -Server $viserver -User $username -Password $password
}

function import_modules {
Import-Module ‘c:\Program Files\VMware\VMware View\Server\extras\PowerShell\add-snapin.ps1’ -ErrorAction SilentlyContinue
Import-Module ‘c:\Program Files (x86)\VMware\Infrastructure\vSphere PowerCLI\Scripts\Initialize-PowerCLIEnvironment.ps1’ -ErrorAction SilentlyContinue
}

function disconnect_vi {
Disconnect-VIServer -Server $viserver -Force
}

function get_pcoip_content{
Get-RemoteSession -state "connected" -protocol "PCOIP" | Get-DesktopVM -ErrorAction SilentlyContinue | %{ #For running from View Connection Broker server
# Get-VM | Get-VMGuest | Where-Object {$_.State -eq "Running"} | %{ #For running from non View Connection Broker server
if (Test-Connection -ComputerName $_.IPAddress -Count 1) { #Check ICMP conenctivity before executing block
$vmname = ("PCoIP:") + $_.HostName.ToString().Split(".")[0]
$filepath = ("\\") + $_.IPAddress + ("\c$\ProgramData\VMware\VDM\Logs\pcoip_server*") #For running from View Connection Broker server
# $filepath = ("\\") + $_.IPaddress[0] + ("\c$\ProgramData\VMware\VDM\Logs\pcoip_server*") #For running from non View Connection Broker server
$file = ""
$file = get-item (Dir -Path $filepath | sort lastwritetime -desc | select -first 1 | %{$_.fullname}) -ErrorAction SilentlyContinue
Select-String $file -Pattern "rto" | select -Last 1 | %{
$pcoip_roundtriptime = $_.ToString().Split("=,")[2].trim()
$pcoip_variance= $_.ToString().Split("=,")[4].trim()
$pcoip_rto = $_.ToString().Split("=,")[6].trim()
$tmpObj = new-object -type psobject
$tmpObj | add-member -membertype noteproperty -name “Rount Trip Time (ms)” -value $pcoip_roundtriptime
$tmpObj | add-member -membertype noteproperty -name “Variance” -value $pcoip_variance
$tmpObj | add-member -membertype noteproperty -name “RTO” -value $pcoip_rto
}
Select-String $file -Pattern "Stat frms" | select -Last 1 | %{
$pcoip_losstx = $_.ToString().Split("=/(%")[12].trim()
$pcoip_lossrx = $_.ToString().Split("=/(%")[14].trim()
$tmpObj | add-member -membertype noteproperty -name “Loss TX (%)” -value $pcoip_losstx
$tmpObj | add-member -membertype noteproperty -name “Loss RX (%)” -value $pcoip_lossrx
}
Select-String $file -Pattern "tbl" | select -Last 1 | %{
$pcoip_fps = $_.ToString().Split(" ")[20].trim()
$tmpObj | add-member -membertype noteproperty -name “FPS” -value $pcoip_fps
}

Select-String $file -Pattern "audio bytes" | select -Last 1 | %{
$pcoip_audiotx = $_.ToString().Split(" ")[16].trim()
$tmpObj | add-member -membertype noteproperty -name “Audio (bytes)” -value $pcoip_audiotx
}
Select-String $file -Pattern "bw limit" | select -Last 1 | %{
$pcoip_bwlimit = $_.ToString().Split("=,")[2].trim()
$pcoip_plateau = $_.ToString().Split("=,")[4].trim()
$pcoip_avgtx = $_.ToString().Split("=,")[6].trim()
$pcoip_avgrx = $_.ToString().Split("=,(")[8].trim()
$tmpObj | add-member -membertype noteproperty -name “Bandwitdh Limit (KBytes/s)” -value $pcoip_bwlimit
$tmpObj | add-member -membertype noteproperty -name “Plateau (KBytes/s)” -value $pcoip_plateau
$tmpObj | add-member -membertype noteproperty -name “Avg TX (KBytes/s)” -value $pcoip_avgtx
$tmpObj | add-member -membertype noteproperty -name “Avg RX (KBytes/s)” -value $pcoip_avgrx
$tmpObj | add-member -membertype noteproperty -name “Name” -value $vmname
$tmpObj
$tmpObj | .\ps_vcops_httpost.ps1 -vcopsip $vcopsip -devicename "PCoIP" -resourceDescription "PCoIP RTO" -applicationname PCoIP –devicetype ps-pcoip -post -vcopsuser $vcopsuser -vcopspass $vcopspass -protocol https
Set-Variable pcoip* -Value 0
}
}
}
}

import_modules
if ($viserver) {connect_vi}

for($x) {
get_pcoip_content
Start-Sleep -Seconds $sleeptime
}
[/css]

Now, place both scripts together in the same folder in one of the Connection Servers and open PowerShell windows. Change Directory to where the scripts are located and execute .\ps_get_pcoip_stats.ps1 [parameters].

-vcopsuser = username for vcops user that will be posting (default blank)

-vcopspass = password for vcops user (default blank)

-vcopsip = the IP/hostname of the vCOps server running the HTTPOST adapter

-sleeptime = time in seconds between checking PCoIP logs for all virtual desktops (default = 20)

image

[css lang=”plain” autolinks=”false” classname=”myclass” collapse=”false” firstline=”1″ padlinenumbers=”false” gutter=”true” smarttabs=”true” tabsize=”10″ toolbar=”true”]
# .\ps_get_pcoip_stats.ps1 -vcopsip 192.168.2.24 -vcopsuser "admin" -vcopspass "password" -sleeptime 10
[/css]
[css lang=”plain” autolinks=”false” classname=”myclass” collapse=”false” firstline=”1″ padlinenumbers=”false” gutter=”true” smarttabs=”true” tabsize=”10″ toolbar=”true”]
# .\ps_get_pcoip_stats.ps1 -viserver 192.168.2.5 -username "lab\administrator" -password "password" -vcopsip 192.168.2.24 -vcopsuser "admin" -vcopspass "password" -sleeptime 50
[/css]

For each virtual desktop having the metrics posted to VCOps the script will provide a screen output with the property, value and name of the desktop.

image

Have Fun!

This article was first published by Andre Leibovici (@andreleibovici) at myvirtualcloud.net. Visit myvirtualcloud.net for more articles about Virtualization, VDI and End User Computing.

1 comment

2 pings

  1. vamshi

    VCOps is a great tool. Thanks for the adapter and the explanation.

  1. - Cliff Davies

    […] long ago I published an article entitled the Unofficial VMware View PCoIP Adapter for VCOps. This VMware View adapter provides PCoIP metrics from any VMware View environment and load them up […]

  2. Automatic IP Assignment and VLAN change in VMware View « vResource.net

    […] Unofficial VMware View PCoIP Adapter for VCOps […]

Leave a Reply