UTM Custom
PRTG Citrix Session Sensor

Let us create custom sensors specifically for your needs

PRTG Citrix Session Sensor​ Case Study

A client has offices around Australia which allows their users to access the Citrix environment via each office and via the internet.  Visibility to Citrix connections per VDI, per office, and remote connections was limited. This made it difficult to visualise Citrix location usage, plan for growth and diagnose performance issues.  

 

UTM created a Citrix VDI session sensor that has provided deep insight into how their Citrix environment is being consumed.

Sensor Overview

A PowerShell script has written to query the Citrix cloud services API for sessions per VDI that is passed into the sensor as a parameter (see code example below for the PRTG geeks). The results are filtered into location by office IP range and output the results into PRTG XML sensor channels. 

 

The sensor also shows the Active and Disconnected Citrix sessions for the VDI to give an overview of the VDI usage. 

Channel Overview

In the above channel overview image, the active session channel has been setup to give a warning when there are over 21 active sessions before the sensor alerts the service desk. The active sessions is the primary channel which is calculated from the active sessions from each state channel, eg VIC, NSW, QLD etc.

Dashboard Display

Dashboard Possibilities

With the use of PRTG Sensor Factory,  each VDI Citrix sensor was calculated into a total environment matrix to be displayed in a dashboard.  

 

In this dashboard section we have 4 citrix VDIs showing the active connections on the right.  The left gauge is the Sensor Factory showing the sum of all sensors to provide a holistic view of the environment. 

 

This provided management with a clean and easy visual of their Citrix environment usage and capacity.

PowwerShell Code Snippet

<#
.SYNOPSIS
Retrieves current Citrix sessions per host in PRTG compatible format


.PARAMETER DNSName
The VDI host of the Sessions

.EXAMPLE
Get-PRTGCitrixSessions.ps1 -DNSName "dvihost-01.citrix.com"

Author:  utm.com.au
Version: 1.1

#>

[CmdletBinding()] param(
    [Parameter(Mandatory = $true)][ValidateNotNullOrEmpty()][string] $DNSName
)

function Out-Prtg {
    [CmdletBinding()] param(
        [Parameter(Position=0, Mandatory=$true, ValueFromPipeline=$true)][array] $SessionData
    )

    # Start writing output to PRTG.
    $XMLOutput = "<prtg>`n"
    
    <# Private Session Calculation Here #>
    
    $XMLOutput += "</prtg>"
    write-host $XMLOutput
}

try {
        
       # $session = New-PSSession -ComputerName $DNSName
       # Invoke-command -Session $session -scriptblock {
       #      asnp Citrix*
       #      $result = Get-BrokerSession
       # } 

        # Count the variable $result and print it to the variable $state.
        #$Sessions = Invoke-Command -Session $session -ScriptBlock {$result}
        asnp Citrix*
        Set-XDCredentials -CustomerId "<customerid>" -APIKey "<apikey>" -SecretKey "<secret>" -ProfileType CloudAPI 
        $Sessions = Get-BrokerSession -DNSName $DNSName
    } catch {
        New-PrtgError -ErrorText "Error retrieving data from $DNSName"
    }

If ($Sessions -ne $null) {
    Out-Prtg -SessionData $Sessions
} else {
    Out-Prtg-NoSession
} 

Channel Data and Settings

Get more control of your alerting by customising each channel. The active session channel has been setup to give a warning when there are over 21 active sessions before the sensor alerts the service desk

Citrix Session History

Keep historical data of your Citrix connections, and get patterns and insights that will help you diagnose issues at any point of time.

 

The graph below shows that between 12 am and 6 am, no one logged into this VDI, which seems to be the pattern each night.